Completed
Push — scrutinizer ( 84e9d0...6a9613 )
by Fabio
22:48
created
framework/Web/UI/WebControls/TTabPanel.php 4 patches
Doc Comments   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -546,7 +546,7 @@  discard block
 block discarded – undo
546 546
 	private $_active=false;
547 547
 
548 548
 	/**
549
-	 * @return the tag name for the view element
549
+	 * @return string tag name for the view element
550 550
 	 */
551 551
 	protected function getTagName()
552 552
 	{
@@ -714,6 +714,7 @@  discard block
 block discarded – undo
714 714
 	/**
715 715
 	 * Finds the index of the tab view whose ID is the same as the one being looked for.
716 716
 	 * @param string the explicit ID of the tab view to be looked for
717
+	 * @param string $id
717 718
 	 * @return integer the index of the tab view found, -1 if not found.
718 719
 	 */
719 720
 	public function findIndexByID($id)
Please login to merge, or discard this patch.
Indentation   +104 added lines, -104 removed lines patch added patch discarded remove patch
@@ -81,9 +81,9 @@  discard block
 block discarded – undo
81 81
 	}
82 82
 
83 83
 	/**
84
-     * Returns the index of the active tab view.
85
-     * Note, this property may not return the correct index.
86
-     * To ensure the correctness, call {@link getActiveView()} first.
84
+	 * Returns the index of the active tab view.
85
+	 * Note, this property may not return the correct index.
86
+	 * To ensure the correctness, call {@link getActiveView()} first.
87 87
 	 * @return integer the zero-based index of the active tab view. If -1, it means no active tab view. Default is 0 (the first view is active).
88 88
 	 */
89 89
 	public function getActiveViewIndex()
@@ -100,24 +100,24 @@  discard block
 block discarded – undo
100 100
 		$this->setViewState('ActiveViewIndex',TPropertyValue::ensureInteger($value),0);
101 101
 	}
102 102
 
103
-    /**
104
-     * Returns the ID of the active tab view.
105
-     * Note, this property may not return the correct ID.
106
-     * To ensure the correctness, call {@link getActiveView()} first.
107
-     * @return string The ID of the active tab view. Defaults to '', meaning not set.
108
-     */
109
-    public function getActiveViewID()
110
-    {
103
+	/**
104
+	 * Returns the ID of the active tab view.
105
+	 * Note, this property may not return the correct ID.
106
+	 * To ensure the correctness, call {@link getActiveView()} first.
107
+	 * @return string The ID of the active tab view. Defaults to '', meaning not set.
108
+	 */
109
+	public function getActiveViewID()
110
+	{
111 111
 		return $this->getViewState('ActiveViewID','');
112
-    }
112
+	}
113 113
 
114
-    /**
115
-     * @param string The ID of the active tab view.
116
-     */
117
-    public function setActiveViewID($value)
118
-    {
114
+	/**
115
+	 * @param string The ID of the active tab view.
116
+	 */
117
+	public function setActiveViewID($value)
118
+	{
119 119
 		$this->setViewState('ActiveViewID',$value,'');
120
-    }
120
+	}
121 121
 
122 122
 	/**
123 123
 	 * Returns the currently active view.
@@ -172,63 +172,63 @@  discard block
 block discarded – undo
172 172
 			throw new TInvalidOperationException('tabpanel_view_inexistent');
173 173
 	}
174 174
 
175
-    /**
176
-     * @return bool status of automatic tab switch on hover
177
-     */
178
-    public function getAutoSwitch()
179
-    {
180
-        return TPropertyValue::ensureBoolean($this->getViewState('AutoSwitch'));
181
-    }
182
-
183
-    /**
184
-     * @param bool whether to enable automatic tab switch on hover
185
-     */
186
-    public function setAutoSwitch($value)
187
-    {
188
-        $this->setViewState('AutoSwitch',TPropertyValue::ensureBoolean($value));
189
-    }
190
-
191
-
192
-    /**
193
-     * @return string URL for the CSS file including all relevant CSS class definitions. Defaults to ''.
194
-     */
195
-    public function getCssUrl()
196
-    {
197
-        return $this->getViewState('CssUrl','default');
198
-    }
199
-
200
-    /**
201
-     * @param string URL for the CSS file including all relevant CSS class definitions.
202
-     */
203
-    public function setCssUrl($value)
204
-    {
205
-        $this->setViewState('CssUrl',TPropertyValue::ensureString($value),'');
206
-    }
207
-
208
-    /**
209
-     * @return string CSS class for the whole tab control div. Defaults to 'tab-panel'.
210
-     */
211
-    public function getCssClass()
212
-    {
213
-    	$cssClass=parent::getCssClass();
214
-    	return $cssClass===''?'tab-panel':$cssClass;
215
-    }
216
-
217
-    /**
218
-     * @return string CSS class for the currently displayed view div. Defaults to 'tab-view'.
219
-     */
220
-    public function getViewCssClass()
221
-    {
222
-        return $this->getViewStyle()->getCssClass();
223
-    }
224
-
225
-    /**
226
-     * @param string CSS class for the currently displayed view div.
227
-     */
228
-    public function setViewCssClass($value)
229
-    {
230
-        $this->getViewStyle()->setCssClass($value);
231
-    }
175
+	/**
176
+	 * @return bool status of automatic tab switch on hover
177
+	 */
178
+	public function getAutoSwitch()
179
+	{
180
+		return TPropertyValue::ensureBoolean($this->getViewState('AutoSwitch'));
181
+	}
182
+
183
+	/**
184
+	 * @param bool whether to enable automatic tab switch on hover
185
+	 */
186
+	public function setAutoSwitch($value)
187
+	{
188
+		$this->setViewState('AutoSwitch',TPropertyValue::ensureBoolean($value));
189
+	}
190
+
191
+
192
+	/**
193
+	 * @return string URL for the CSS file including all relevant CSS class definitions. Defaults to ''.
194
+	 */
195
+	public function getCssUrl()
196
+	{
197
+		return $this->getViewState('CssUrl','default');
198
+	}
199
+
200
+	/**
201
+	 * @param string URL for the CSS file including all relevant CSS class definitions.
202
+	 */
203
+	public function setCssUrl($value)
204
+	{
205
+		$this->setViewState('CssUrl',TPropertyValue::ensureString($value),'');
206
+	}
207
+
208
+	/**
209
+	 * @return string CSS class for the whole tab control div. Defaults to 'tab-panel'.
210
+	 */
211
+	public function getCssClass()
212
+	{
213
+		$cssClass=parent::getCssClass();
214
+		return $cssClass===''?'tab-panel':$cssClass;
215
+	}
216
+
217
+	/**
218
+	 * @return string CSS class for the currently displayed view div. Defaults to 'tab-view'.
219
+	 */
220
+	public function getViewCssClass()
221
+	{
222
+		return $this->getViewStyle()->getCssClass();
223
+	}
224
+
225
+	/**
226
+	 * @param string CSS class for the currently displayed view div.
227
+	 */
228
+	public function setViewCssClass($value)
229
+	{
230
+		$this->getViewStyle()->setCssClass($value);
231
+	}
232 232
 
233 233
 	/**
234 234
 	 * @return TStyle the style for all the view div
@@ -244,21 +244,21 @@  discard block
 block discarded – undo
244 244
 		return $style;
245 245
 	}
246 246
 
247
-    /**
248
-     * @return string CSS class for non-active tabs. Defaults to 'tab-normal'.
249
-     */
250
-    public function getTabCssClass()
251
-    {
252
-        return $this->getTabStyle()->getCssClass();
253
-    }
247
+	/**
248
+	 * @return string CSS class for non-active tabs. Defaults to 'tab-normal'.
249
+	 */
250
+	public function getTabCssClass()
251
+	{
252
+		return $this->getTabStyle()->getCssClass();
253
+	}
254 254
 
255
-    /**
256
-     * @param string CSS class for non-active tabs.
257
-     */
258
-    public function setTabCssClass($value)
259
-    {
260
-        $this->getTabStyle()->setCssClass($value);
261
-    }
255
+	/**
256
+	 * @param string CSS class for non-active tabs.
257
+	 */
258
+	public function setTabCssClass($value)
259
+	{
260
+		$this->getTabStyle()->setCssClass($value);
261
+	}
262 262
 
263 263
 	/**
264 264
 	 * @return TStyle the style for all the inactive tab div
@@ -274,21 +274,21 @@  discard block
 block discarded – undo
274 274
 		return $style;
275 275
 	}
276 276
 
277
-    /**
278
-     * @return string CSS class for the active tab. Defaults to 'tab-active'.
279
-     */
280
-    public function getActiveTabCssClass()
281
-    {
282
-        return $this->getActiveTabStyle()->getCssClass();
283
-    }
284
-
285
-    /**
286
-     * @param string CSS class for the active tab.
287
-     */
288
-    public function setActiveTabCssClass($value)
289
-    {
290
-        $this->getActiveTabStyle()->setCssClass($value);
291
-    }
277
+	/**
278
+	 * @return string CSS class for the active tab. Defaults to 'tab-active'.
279
+	 */
280
+	public function getActiveTabCssClass()
281
+	{
282
+		return $this->getActiveTabStyle()->getCssClass();
283
+	}
284
+
285
+	/**
286
+	 * @param string CSS class for the active tab.
287
+	 */
288
+	public function setActiveTabCssClass($value)
289
+	{
290
+		$this->getActiveTabStyle()->setCssClass($value);
291
+	}
292 292
 
293 293
 	/**
294 294
 	 * @return TStyle the style for the active tab div
Please login to merge, or discard this patch.
Spacing   +89 added lines, -89 removed lines patch added patch discarded remove patch
@@ -58,7 +58,7 @@  discard block
 block discarded – undo
58 58
  */
59 59
 class TTabPanel extends TWebControl implements IPostBackDataHandler
60 60
 {
61
-	private $_dataChanged=false;
61
+	private $_dataChanged = false;
62 62
 
63 63
 	/**
64 64
 	 * @return string tag name for the control
@@ -76,7 +76,7 @@  discard block
 block discarded – undo
76 76
 	 */
77 77
 	public function addParsedObject($object)
78 78
 	{
79
-		if($object instanceof TTabView)
79
+		if ($object instanceof TTabView)
80 80
 			$this->getControls()->add($object);
81 81
 	}
82 82
 
@@ -88,7 +88,7 @@  discard block
 block discarded – undo
88 88
 	 */
89 89
 	public function getActiveViewIndex()
90 90
 	{
91
-		return $this->getViewState('ActiveViewIndex',0);
91
+		return $this->getViewState('ActiveViewIndex', 0);
92 92
 	}
93 93
 
94 94
 	/**
@@ -97,7 +97,7 @@  discard block
 block discarded – undo
97 97
 	 */
98 98
 	public function setActiveViewIndex($value)
99 99
 	{
100
-		$this->setViewState('ActiveViewIndex',TPropertyValue::ensureInteger($value),0);
100
+		$this->setViewState('ActiveViewIndex', TPropertyValue::ensureInteger($value), 0);
101 101
 	}
102 102
 
103 103
     /**
@@ -108,7 +108,7 @@  discard block
 block discarded – undo
108 108
      */
109 109
     public function getActiveViewID()
110 110
     {
111
-		return $this->getViewState('ActiveViewID','');
111
+		return $this->getViewState('ActiveViewID', '');
112 112
     }
113 113
 
114 114
     /**
@@ -116,7 +116,7 @@  discard block
 block discarded – undo
116 116
      */
117 117
     public function setActiveViewID($value)
118 118
     {
119
-		$this->setViewState('ActiveViewID',$value,'');
119
+		$this->setViewState('ActiveViewID', $value, '');
120 120
     }
121 121
 
122 122
 	/**
@@ -128,34 +128,34 @@  discard block
 block discarded – undo
128 128
 	 */
129 129
 	public function getActiveView()
130 130
 	{
131
-		$activeView=null;
132
-		$views=$this->getViews();
133
-		if(($id=$this->getActiveViewID())!=='')
131
+		$activeView = null;
132
+		$views = $this->getViews();
133
+		if (($id = $this->getActiveViewID()) !== '')
134 134
 		{
135
-			if(($index=$views->findIndexByID($id))>=0)
136
-				$activeView=$views->itemAt($index);
135
+			if (($index = $views->findIndexByID($id)) >= 0)
136
+				$activeView = $views->itemAt($index);
137 137
 			else
138
-				throw new TInvalidDataValueException('tabpanel_activeviewid_invalid',$id);
138
+				throw new TInvalidDataValueException('tabpanel_activeviewid_invalid', $id);
139 139
 		}
140
-		else if(($index=$this->getActiveViewIndex())>=0)
140
+		else if (($index = $this->getActiveViewIndex()) >= 0)
141 141
 		{
142
-			if($index<$views->getCount())
143
-				$activeView=$views->itemAt($index);
142
+			if ($index < $views->getCount())
143
+				$activeView = $views->itemAt($index);
144 144
 			else
145
-				throw new TInvalidDataValueException('tabpanel_activeviewindex_invalid',$index);
145
+				throw new TInvalidDataValueException('tabpanel_activeviewindex_invalid', $index);
146 146
 		}
147 147
 		else
148 148
 		{
149
-			foreach($views as $index=>$view)
149
+			foreach ($views as $index=>$view)
150 150
 			{
151
-				if($view->getActive())
151
+				if ($view->getActive())
152 152
 				{
153
-					$activeView=$view;
153
+					$activeView = $view;
154 154
 					break;
155 155
 				}
156 156
 			}
157 157
 		}
158
-		if($activeView!==null)
158
+		if ($activeView !== null)
159 159
 			$this->activateView($activeView);
160 160
 		return $activeView;
161 161
 	}
@@ -166,7 +166,7 @@  discard block
 block discarded – undo
166 166
 	 */
167 167
 	public function setActiveView($view)
168 168
 	{
169
-		if($this->getViews()->indexOf($view)>=0)
169
+		if ($this->getViews()->indexOf($view) >= 0)
170 170
 			$this->activateView($view);
171 171
 		else
172 172
 			throw new TInvalidOperationException('tabpanel_view_inexistent');
@@ -185,7 +185,7 @@  discard block
 block discarded – undo
185 185
      */
186 186
     public function setAutoSwitch($value)
187 187
     {
188
-        $this->setViewState('AutoSwitch',TPropertyValue::ensureBoolean($value));
188
+        $this->setViewState('AutoSwitch', TPropertyValue::ensureBoolean($value));
189 189
     }
190 190
 
191 191
 
@@ -194,7 +194,7 @@  discard block
 block discarded – undo
194 194
      */
195 195
     public function getCssUrl()
196 196
     {
197
-        return $this->getViewState('CssUrl','default');
197
+        return $this->getViewState('CssUrl', 'default');
198 198
     }
199 199
 
200 200
     /**
@@ -202,7 +202,7 @@  discard block
 block discarded – undo
202 202
      */
203 203
     public function setCssUrl($value)
204 204
     {
205
-        $this->setViewState('CssUrl',TPropertyValue::ensureString($value),'');
205
+        $this->setViewState('CssUrl', TPropertyValue::ensureString($value), '');
206 206
     }
207 207
 
208 208
     /**
@@ -210,8 +210,8 @@  discard block
 block discarded – undo
210 210
      */
211 211
     public function getCssClass()
212 212
     {
213
-    	$cssClass=parent::getCssClass();
214
-    	return $cssClass===''?'tab-panel':$cssClass;
213
+    	$cssClass = parent::getCssClass();
214
+    	return $cssClass === '' ? 'tab-panel' : $cssClass;
215 215
     }
216 216
 
217 217
     /**
@@ -235,11 +235,11 @@  discard block
 block discarded – undo
235 235
 	 */
236 236
 	public function getViewStyle()
237 237
 	{
238
-		if(($style=$this->getViewState('ViewStyle',null))===null)
238
+		if (($style = $this->getViewState('ViewStyle', null)) === null)
239 239
 		{
240
-			$style=new TStyle;
240
+			$style = new TStyle;
241 241
 			$style->setCssClass('tab-view');
242
-			$this->setViewState('ViewStyle',$style,null);
242
+			$this->setViewState('ViewStyle', $style, null);
243 243
 		}
244 244
 		return $style;
245 245
 	}
@@ -265,11 +265,11 @@  discard block
 block discarded – undo
265 265
 	 */
266 266
 	public function getTabStyle()
267 267
 	{
268
-		if(($style=$this->getViewState('TabStyle',null))===null)
268
+		if (($style = $this->getViewState('TabStyle', null)) === null)
269 269
 		{
270
-			$style=new TStyle;
270
+			$style = new TStyle;
271 271
 			$style->setCssClass('tab-normal');
272
-			$this->setViewState('TabStyle',$style,null);
272
+			$this->setViewState('TabStyle', $style, null);
273 273
 		}
274 274
 		return $style;
275 275
 	}
@@ -295,11 +295,11 @@  discard block
 block discarded – undo
295 295
 	 */
296 296
 	public function getActiveTabStyle()
297 297
 	{
298
-		if(($style=$this->getViewState('ActiveTabStyle',null))===null)
298
+		if (($style = $this->getViewState('ActiveTabStyle', null)) === null)
299 299
 		{
300
-			$style=new TStyle;
300
+			$style = new TStyle;
301 301
 			$style->setCssClass('tab-active');
302
-			$this->setViewState('ActiveTabStyle',$style,null);
302
+			$this->setViewState('ActiveTabStyle', $style, null);
303 303
 		}
304 304
 		return $style;
305 305
 	}
@@ -313,9 +313,9 @@  discard block
 block discarded – undo
313 313
 	{
314 314
 		$this->setActiveViewIndex(-1);
315 315
 		$this->setActiveViewID('');
316
-		foreach($this->getViews() as $index=>$v)
316
+		foreach ($this->getViews() as $index=>$v)
317 317
 		{
318
-			if($view===$v)
318
+			if ($view === $v)
319 319
 			{
320 320
 				$this->setActiveViewIndex($index);
321 321
 				$this->setActiveViewID($view->getID(false));
@@ -333,17 +333,17 @@  discard block
 block discarded – undo
333 333
 	 * @param array the input data collection
334 334
 	 * @return boolean whether the data of the control has been changed
335 335
 	 */
336
-	public function loadPostData($key,$values)
336
+	public function loadPostData($key, $values)
337 337
 	{
338
-		if(($index=$values[$this->getClientID().'_1'])!==null)
338
+		if (($index = $values[$this->getClientID() . '_1']) !== null)
339 339
 		{
340
-			$index=(int)$index;
341
-			$currentIndex=$this->getActiveViewIndex();
342
-			if($currentIndex!==$index)
340
+			$index = (int) $index;
341
+			$currentIndex = $this->getActiveViewIndex();
342
+			if ($currentIndex !== $index)
343 343
 			{
344 344
 				$this->setActiveViewID(''); // clear up view ID
345 345
 				$this->setActiveViewIndex($index);
346
-				return $this->_dataChanged=true;
346
+				return $this->_dataChanged = true;
347 347
 			}
348 348
 		}
349 349
 		return false;
@@ -377,7 +377,7 @@  discard block
 block discarded – undo
377 377
 	 */
378 378
 	protected function addAttributesToRender($writer)
379 379
 	{
380
-		$writer->addAttribute('id',$this->getClientID());
380
+		$writer->addAttribute('id', $this->getClientID());
381 381
 		$this->setCssClass($this->getCssClass());
382 382
 		parent::addAttributesToRender($writer);
383 383
 	}
@@ -390,12 +390,12 @@  discard block
 block discarded – undo
390 390
 	public function onPreRender($param)
391 391
 	{
392 392
 		parent::onPreRender($param);
393
-		$this->getActiveView();  // determine the active view
393
+		$this->getActiveView(); // determine the active view
394 394
 		$this->registerStyleSheet();
395 395
 
396
-		$page=$this->getPage();
396
+		$page = $this->getPage();
397 397
 		$page->registerRequiresPostData($this);
398
-		$page->registerRequiresPostData($this->getClientID()."_1");
398
+		$page->registerRequiresPostData($this->getClientID() . "_1");
399 399
 	}
400 400
 
401 401
 	/**
@@ -407,15 +407,15 @@  discard block
 block discarded – undo
407 407
 	{
408 408
 		$url = $this->getCssUrl();
409 409
 
410
-		if($url === '') {
410
+		if ($url === '') {
411 411
 			return;
412 412
 		}
413 413
 
414
-		if($url === 'default') {
415
-			$url = $this->getApplication()->getAssetManager()->publishFilePath(dirname(__FILE__).DIRECTORY_SEPARATOR.'assets'.DIRECTORY_SEPARATOR.'tabpanel.css');
414
+		if ($url === 'default') {
415
+			$url = $this->getApplication()->getAssetManager()->publishFilePath(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'assets' . DIRECTORY_SEPARATOR . 'tabpanel.css');
416 416
 		}
417 417
 
418
-		if($url !== '') {
418
+		if ($url !== '') {
419 419
 			$this->getPage()->getClientScript()->registerStyleSheetFile($url, $url);
420 420
 		}
421 421
 	}
@@ -425,18 +425,18 @@  discard block
 block discarded – undo
425 425
 	 */
426 426
 	protected function registerClientScript()
427 427
 	{
428
-		$id=$this->getClientID();
429
-		$options=TJavaScript::encode($this->getClientOptions());
430
-		$className=$this->getClientClassName();
431
-		$cs=$this->getPage()->getClientScript();
428
+		$id = $this->getClientID();
429
+		$options = TJavaScript::encode($this->getClientOptions());
430
+		$className = $this->getClientClassName();
431
+		$cs = $this->getPage()->getClientScript();
432 432
 		$cs->registerPradoScript('tabpanel');
433
-		$code="new $className($options);";
433
+		$code = "new $className($options);";
434 434
 		$cs->registerEndScript("prado:$id", $code);
435 435
 		// ensure an item is always active and visible
436 436
 		$index = $this->getActiveViewIndex();
437
-		if(!$this->getViews()->itemAt($index)->Visible)
438
-			$index=0;
439
-		$cs->registerHiddenField($id.'_1', $index);
437
+		if (!$this->getViews()->itemAt($index)->Visible)
438
+			$index = 0;
439
+		$cs->registerHiddenField($id . '_1', $index);
440 440
 	}
441 441
 
442 442
 	/**
@@ -459,7 +459,7 @@  discard block
 block discarded – undo
459 459
 		$options['NormalCssClass'] = $this->getTabCssClass();
460 460
 		$viewIDs = array();
461 461
 		$viewVis = array();
462
-		foreach($this->getViews() as $view)
462
+		foreach ($this->getViews() as $view)
463 463
 		{
464 464
 			$viewIDs[] = $view->getClientID();
465 465
 			$viewVis[] = $view->getVisible();
@@ -500,18 +500,18 @@  discard block
 block discarded – undo
500 500
 	 */
501 501
 	public function renderContents($writer)
502 502
 	{
503
-		$views=$this->getViews();
504
-		if($views->getCount()>0)
503
+		$views = $this->getViews();
504
+		if ($views->getCount() > 0)
505 505
 		{
506 506
 			$writer->writeLine();
507 507
 			// render tab bar
508
-			foreach($views as $view)
508
+			foreach ($views as $view)
509 509
 			{
510 510
 				$view->renderTab($writer);
511 511
 				$writer->writeLine();
512 512
 			}
513 513
 			// render tab views
514
-			foreach($views as $view)
514
+			foreach ($views as $view)
515 515
 			{
516 516
 				$view->renderControl($writer);
517 517
 				$writer->writeLine();
@@ -543,7 +543,7 @@  discard block
 block discarded – undo
543 543
  */
544 544
 class TTabView extends TWebControl
545 545
 {
546
-	private $_active=false;
546
+	private $_active = false;
547 547
 
548 548
 	/**
549 549
 	 * @return the tag name for the view element
@@ -559,14 +559,14 @@  discard block
 block discarded – undo
559 559
 	 */
560 560
 	protected function addAttributesToRender($writer)
561 561
 	{
562
-		if(!$this->getActive() && $this->getPage()->getClientSupportsJavaScript())
563
-			$this->getStyle()->setStyleField('display','none');
562
+		if (!$this->getActive() && $this->getPage()->getClientSupportsJavaScript())
563
+			$this->getStyle()->setStyleField('display', 'none');
564 564
 
565 565
 		$this->getStyle()->mergeWith($this->getParent()->getViewStyle());
566 566
 
567 567
 		parent::addAttributesToRender($writer);
568 568
 
569
-		$writer->addAttribute('id',$this->getClientID());
569
+		$writer->addAttribute('id', $this->getClientID());
570 570
 	}
571 571
 
572 572
 	/**
@@ -574,7 +574,7 @@  discard block
 block discarded – undo
574 574
 	 */
575 575
 	public function getCaption()
576 576
 	{
577
-		return $this->getViewState('Caption','');
577
+		return $this->getViewState('Caption', '');
578 578
 	}
579 579
 
580 580
 	/**
@@ -582,7 +582,7 @@  discard block
 block discarded – undo
582 582
 	 */
583 583
 	public function setCaption($value)
584 584
 	{
585
-		$this->setViewState('Caption',TPropertyValue::ensureString($value),'');
585
+		$this->setViewState('Caption', TPropertyValue::ensureString($value), '');
586 586
 	}
587 587
 
588 588
 	/**
@@ -590,7 +590,7 @@  discard block
 block discarded – undo
590 590
 	 */
591 591
 	public function getNavigateUrl()
592 592
 	{
593
-		return $this->getViewState('NavigateUrl','');
593
+		return $this->getViewState('NavigateUrl', '');
594 594
 	}
595 595
 
596 596
 	/**
@@ -600,7 +600,7 @@  discard block
 block discarded – undo
600 600
 	 */
601 601
 	public function setNavigateUrl($value)
602 602
 	{
603
-		$this->setViewState('NavigateUrl',TPropertyValue::ensureString($value),'');
603
+		$this->setViewState('NavigateUrl', TPropertyValue::ensureString($value), '');
604 604
 	}
605 605
 
606 606
 	/**
@@ -608,7 +608,7 @@  discard block
 block discarded – undo
608 608
 	 */
609 609
 	public function getText()
610 610
 	{
611
-		return $this->getViewState('Text','');
611
+		return $this->getViewState('Text', '');
612 612
 	}
613 613
 
614 614
 	/**
@@ -618,7 +618,7 @@  discard block
 block discarded – undo
618 618
 	 */
619 619
 	public function setText($value)
620 620
 	{
621
-		$this->setViewState('Text',TPropertyValue::ensureString($value),'');
621
+		$this->setViewState('Text', TPropertyValue::ensureString($value), '');
622 622
 	}
623 623
 
624 624
 	/**
@@ -634,7 +634,7 @@  discard block
 block discarded – undo
634 634
 	 */
635 635
 	public function setActive($value)
636 636
 	{
637
-		$this->_active=TPropertyValue::ensureBoolean($value);
637
+		$this->_active = TPropertyValue::ensureBoolean($value);
638 638
 	}
639 639
 
640 640
 	/**
@@ -643,9 +643,9 @@  discard block
 block discarded – undo
643 643
 	 */
644 644
 	public function renderContents($writer)
645 645
 	{
646
-		if(($text=$this->getText())!=='')
646
+		if (($text = $this->getText()) !== '')
647 647
 			$writer->write($text);
648
-		else if($this->getHasControls())
648
+		else if ($this->getHasControls())
649 649
 			parent::renderContents($writer);
650 650
 	}
651 651
 
@@ -655,11 +655,11 @@  discard block
 block discarded – undo
655 655
 	 */
656 656
 	public function renderTab($writer)
657 657
 	{
658
-		if($this->getVisible(false) && $this->getPage()->getClientSupportsJavaScript())
658
+		if ($this->getVisible(false) && $this->getPage()->getClientSupportsJavaScript())
659 659
 		{
660
-			$writer->addAttribute('id',$this->getClientID().'_0');
660
+			$writer->addAttribute('id', $this->getClientID() . '_0');
661 661
 
662
-			$style=$this->getActive()?$this->getParent()->getActiveTabStyle():$this->getParent()->getTabStyle();
662
+			$style = $this->getActive() ? $this->getParent()->getActiveTabStyle() : $this->getParent()->getTabStyle();
663 663
 			$style->addAttributesToRender($writer);
664 664
 
665 665
 			$writer->renderBeginTag($this->getTagName());
@@ -677,10 +677,10 @@  discard block
 block discarded – undo
677 677
 	 */
678 678
 	protected function renderTabContent($writer)
679 679
 	{
680
-		if(($url=$this->getNavigateUrl())==='')
681
-			$url='javascript://';
682
-		if(($caption=$this->getCaption())==='')
683
-			$caption='&nbsp;';
680
+		if (($url = $this->getNavigateUrl()) === '')
681
+			$url = 'javascript://';
682
+		if (($caption = $this->getCaption()) === '')
683
+			$caption = '&nbsp;';
684 684
 		$writer->write("<a href=\"{$url}\">{$caption}</a>");
685 685
 	}
686 686
 }
@@ -703,10 +703,10 @@  discard block
 block discarded – undo
703 703
 	 * @param mixed new item
704 704
 	 * @throws TInvalidDataTypeException if the item to be inserted is not a {@link TTabView} object.
705 705
 	 */
706
-	public function insertAt($index,$item)
706
+	public function insertAt($index, $item)
707 707
 	{
708
-		if($item instanceof TTabView)
709
-			parent::insertAt($index,$item);
708
+		if ($item instanceof TTabView)
709
+			parent::insertAt($index, $item);
710 710
 		else
711 711
 			throw new TInvalidDataTypeException('tabviewcollection_tabview_required');
712 712
 	}
@@ -718,9 +718,9 @@  discard block
 block discarded – undo
718 718
 	 */
719 719
 	public function findIndexByID($id)
720 720
 	{
721
-		foreach($this as $index=>$view)
721
+		foreach ($this as $index=>$view)
722 722
 		{
723
-			if($view->getID(false)===$id)
723
+			if ($view->getID(false) === $id)
724 724
 				return $index;
725 725
 		}
726 726
 		return -1;
Please login to merge, or discard this patch.
Braces   +50 added lines, -40 removed lines patch added patch discarded remove patch
@@ -76,8 +76,9 @@  discard block
 block discarded – undo
76 76
 	 */
77 77
 	public function addParsedObject($object)
78 78
 	{
79
-		if($object instanceof TTabView)
80
-			$this->getControls()->add($object);
79
+		if($object instanceof TTabView) {
80
+					$this->getControls()->add($object);
81
+		}
81 82
 	}
82 83
 
83 84
 	/**
@@ -132,19 +133,19 @@  discard block
 block discarded – undo
132 133
 		$views=$this->getViews();
133 134
 		if(($id=$this->getActiveViewID())!=='')
134 135
 		{
135
-			if(($index=$views->findIndexByID($id))>=0)
136
-				$activeView=$views->itemAt($index);
137
-			else
138
-				throw new TInvalidDataValueException('tabpanel_activeviewid_invalid',$id);
139
-		}
140
-		else if(($index=$this->getActiveViewIndex())>=0)
136
+			if(($index=$views->findIndexByID($id))>=0) {
137
+							$activeView=$views->itemAt($index);
138
+			} else {
139
+							throw new TInvalidDataValueException('tabpanel_activeviewid_invalid',$id);
140
+			}
141
+		} else if(($index=$this->getActiveViewIndex())>=0)
141 142
 		{
142
-			if($index<$views->getCount())
143
-				$activeView=$views->itemAt($index);
144
-			else
145
-				throw new TInvalidDataValueException('tabpanel_activeviewindex_invalid',$index);
146
-		}
147
-		else
143
+			if($index<$views->getCount()) {
144
+							$activeView=$views->itemAt($index);
145
+			} else {
146
+							throw new TInvalidDataValueException('tabpanel_activeviewindex_invalid',$index);
147
+			}
148
+		} else
148 149
 		{
149 150
 			foreach($views as $index=>$view)
150 151
 			{
@@ -155,8 +156,9 @@  discard block
 block discarded – undo
155 156
 				}
156 157
 			}
157 158
 		}
158
-		if($activeView!==null)
159
-			$this->activateView($activeView);
159
+		if($activeView!==null) {
160
+					$this->activateView($activeView);
161
+		}
160 162
 		return $activeView;
161 163
 	}
162 164
 
@@ -166,10 +168,11 @@  discard block
 block discarded – undo
166 168
 	 */
167 169
 	public function setActiveView($view)
168 170
 	{
169
-		if($this->getViews()->indexOf($view)>=0)
170
-			$this->activateView($view);
171
-		else
172
-			throw new TInvalidOperationException('tabpanel_view_inexistent');
171
+		if($this->getViews()->indexOf($view)>=0) {
172
+					$this->activateView($view);
173
+		} else {
174
+					throw new TInvalidOperationException('tabpanel_view_inexistent');
175
+		}
173 176
 	}
174 177
 
175 178
     /**
@@ -320,9 +323,9 @@  discard block
 block discarded – undo
320 323
 				$this->setActiveViewIndex($index);
321 324
 				$this->setActiveViewID($view->getID(false));
322 325
 				$view->setActive(true);
326
+			} else {
327
+							$v->setActive(false);
323 328
 			}
324
-			else
325
-				$v->setActive(false);
326 329
 		}
327 330
 	}
328 331
 
@@ -434,8 +437,9 @@  discard block
 block discarded – undo
434 437
 		$cs->registerEndScript("prado:$id", $code);
435 438
 		// ensure an item is always active and visible
436 439
 		$index = $this->getActiveViewIndex();
437
-		if(!$this->getViews()->itemAt($index)->Visible)
438
-			$index=0;
440
+		if(!$this->getViews()->itemAt($index)->Visible) {
441
+					$index=0;
442
+		}
439 443
 		$cs->registerHiddenField($id.'_1', $index);
440 444
 	}
441 445
 
@@ -559,8 +563,9 @@  discard block
 block discarded – undo
559 563
 	 */
560 564
 	protected function addAttributesToRender($writer)
561 565
 	{
562
-		if(!$this->getActive() && $this->getPage()->getClientSupportsJavaScript())
563
-			$this->getStyle()->setStyleField('display','none');
566
+		if(!$this->getActive() && $this->getPage()->getClientSupportsJavaScript()) {
567
+					$this->getStyle()->setStyleField('display','none');
568
+		}
564 569
 
565 570
 		$this->getStyle()->mergeWith($this->getParent()->getViewStyle());
566 571
 
@@ -643,10 +648,11 @@  discard block
 block discarded – undo
643 648
 	 */
644 649
 	public function renderContents($writer)
645 650
 	{
646
-		if(($text=$this->getText())!=='')
647
-			$writer->write($text);
648
-		else if($this->getHasControls())
649
-			parent::renderContents($writer);
651
+		if(($text=$this->getText())!=='') {
652
+					$writer->write($text);
653
+		} else if($this->getHasControls()) {
654
+					parent::renderContents($writer);
655
+		}
650 656
 	}
651 657
 
652 658
 	/**
@@ -677,10 +683,12 @@  discard block
 block discarded – undo
677 683
 	 */
678 684
 	protected function renderTabContent($writer)
679 685
 	{
680
-		if(($url=$this->getNavigateUrl())==='')
681
-			$url='javascript://';
682
-		if(($caption=$this->getCaption())==='')
683
-			$caption='&nbsp;';
686
+		if(($url=$this->getNavigateUrl())==='') {
687
+					$url='javascript://';
688
+		}
689
+		if(($caption=$this->getCaption())==='') {
690
+					$caption='&nbsp;';
691
+		}
684 692
 		$writer->write("<a href=\"{$url}\">{$caption}</a>");
685 693
 	}
686 694
 }
@@ -705,10 +713,11 @@  discard block
 block discarded – undo
705 713
 	 */
706 714
 	public function insertAt($index,$item)
707 715
 	{
708
-		if($item instanceof TTabView)
709
-			parent::insertAt($index,$item);
710
-		else
711
-			throw new TInvalidDataTypeException('tabviewcollection_tabview_required');
716
+		if($item instanceof TTabView) {
717
+					parent::insertAt($index,$item);
718
+		} else {
719
+					throw new TInvalidDataTypeException('tabviewcollection_tabview_required');
720
+		}
712 721
 	}
713 722
 
714 723
 	/**
@@ -720,8 +729,9 @@  discard block
 block discarded – undo
720 729
 	{
721 730
 		foreach($this as $index=>$view)
722 731
 		{
723
-			if($view->getID(false)===$id)
724
-				return $index;
732
+			if($view->getID(false)===$id) {
733
+							return $index;
734
+			}
725 735
 		}
726 736
 		return -1;
727 737
 	}
Please login to merge, or discard this patch.
framework/Web/UI/WebControls/TTemplateColumn.php 3 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -118,7 +118,7 @@
 block discarded – undo
118 118
 	}
119 119
 
120 120
 	/**
121
-	 * @return ITemplate the item template
121
+	 * @return string the item template
122 122
 	 */
123 123
 	public function getItemTemplate()
124 124
 	{
Please login to merge, or discard this patch.
Spacing   +47 added lines, -47 removed lines patch added patch discarded remove patch
@@ -42,10 +42,10 @@  discard block
 block discarded – undo
42 42
 	 * Various item templates
43 43
 	 * @var string
44 44
 	 */
45
-	private $_itemTemplate=null;
46
-	private $_editItemTemplate=null;
47
-	private $_headerTemplate=null;
48
-	private $_footerTemplate=null;
45
+	private $_itemTemplate = null;
46
+	private $_editItemTemplate = null;
47
+	private $_headerTemplate = null;
48
+	private $_footerTemplate = null;
49 49
 
50 50
 	/**
51 51
 	 * @return string the class name for the item cell renderer. Defaults to empty, meaning not set.
@@ -53,7 +53,7 @@  discard block
 block discarded – undo
53 53
 	 */
54 54
 	public function getItemRenderer()
55 55
 	{
56
-		return $this->getViewState('ItemRenderer','');
56
+		return $this->getViewState('ItemRenderer', '');
57 57
 	}
58 58
 
59 59
 	/**
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
 	 */
70 70
 	public function setItemRenderer($value)
71 71
 	{
72
-		$this->setViewState('ItemRenderer',$value,'');
72
+		$this->setViewState('ItemRenderer', $value, '');
73 73
 	}
74 74
 
75 75
 	/**
@@ -78,7 +78,7 @@  discard block
 block discarded – undo
78 78
 	 */
79 79
 	public function getEditItemRenderer()
80 80
 	{
81
-		return $this->getViewState('EditItemRenderer','');
81
+		return $this->getViewState('EditItemRenderer', '');
82 82
 	}
83 83
 
84 84
 	/**
@@ -94,7 +94,7 @@  discard block
 block discarded – undo
94 94
 	 */
95 95
 	public function setEditItemRenderer($value)
96 96
 	{
97
-		$this->setViewState('EditItemRenderer',$value,'');
97
+		$this->setViewState('EditItemRenderer', $value, '');
98 98
 	}
99 99
 
100 100
 	/**
@@ -111,10 +111,10 @@  discard block
 block discarded – undo
111 111
 	 */
112 112
 	public function setEditItemTemplate($value)
113 113
 	{
114
-		if($value instanceof ITemplate || $value===null)
115
-			$this->_editItemTemplate=$value;
114
+		if ($value instanceof ITemplate || $value === null)
115
+			$this->_editItemTemplate = $value;
116 116
 		else
117
-			throw new TInvalidDataTypeException('templatecolumn_template_required','EditItemTemplate');
117
+			throw new TInvalidDataTypeException('templatecolumn_template_required', 'EditItemTemplate');
118 118
 	}
119 119
 
120 120
 	/**
@@ -131,10 +131,10 @@  discard block
 block discarded – undo
131 131
 	 */
132 132
 	public function setItemTemplate($value)
133 133
 	{
134
-		if($value instanceof ITemplate || $value===null)
135
-			$this->_itemTemplate=$value;
134
+		if ($value instanceof ITemplate || $value === null)
135
+			$this->_itemTemplate = $value;
136 136
 		else
137
-			throw new TInvalidDataTypeException('templatecolumn_template_required','ItemTemplate');
137
+			throw new TInvalidDataTypeException('templatecolumn_template_required', 'ItemTemplate');
138 138
 	}
139 139
 
140 140
 	/**
@@ -151,10 +151,10 @@  discard block
 block discarded – undo
151 151
 	 */
152 152
 	public function setHeaderTemplate($value)
153 153
 	{
154
-		if($value instanceof ITemplate || $value===null)
155
-			$this->_headerTemplate=$value;
154
+		if ($value instanceof ITemplate || $value === null)
155
+			$this->_headerTemplate = $value;
156 156
 		else
157
-			throw new TInvalidDataTypeException('templatecolumn_template_required','HeaderTemplate');
157
+			throw new TInvalidDataTypeException('templatecolumn_template_required', 'HeaderTemplate');
158 158
 	}
159 159
 
160 160
 	/**
@@ -171,10 +171,10 @@  discard block
 block discarded – undo
171 171
 	 */
172 172
 	public function setFooterTemplate($value)
173 173
 	{
174
-		if($value instanceof ITemplate || $value===null)
175
-			$this->_footerTemplate=$value;
174
+		if ($value instanceof ITemplate || $value === null)
175
+			$this->_footerTemplate = $value;
176 176
 		else
177
-			throw new TInvalidDataTypeException('templatecolumn_template_required','FooterTemplate');
177
+			throw new TInvalidDataTypeException('templatecolumn_template_required', 'FooterTemplate');
178 178
 	}
179 179
 
180 180
 	/**
@@ -186,57 +186,57 @@  discard block
 block discarded – undo
186 186
 	 * @param integer the index to the Columns property that the cell resides in.
187 187
 	 * @param string the type of cell (Header,Footer,Item,AlternatingItem,EditItem,SelectedItem)
188 188
 	 */
189
-	public function initializeCell($cell,$columnIndex,$itemType)
189
+	public function initializeCell($cell, $columnIndex, $itemType)
190 190
 	{
191
-		if($itemType===TListItemType::Item || $itemType===TListItemType::AlternatingItem || $itemType===TListItemType::SelectedItem || $itemType===TListItemType::EditItem)
191
+		if ($itemType === TListItemType::Item || $itemType === TListItemType::AlternatingItem || $itemType === TListItemType::SelectedItem || $itemType === TListItemType::EditItem)
192 192
 		{
193
-			if($itemType===TListItemType::EditItem)
193
+			if ($itemType === TListItemType::EditItem)
194 194
 			{
195
-				if(($classPath=$this->getEditItemRenderer())==='' && ($template=$this->_editItemTemplate)===null)
195
+				if (($classPath = $this->getEditItemRenderer()) === '' && ($template = $this->_editItemTemplate) === null)
196 196
 				{
197
-					$classPath=$this->getItemRenderer();
198
-					$template=$this->_itemTemplate;
197
+					$classPath = $this->getItemRenderer();
198
+					$template = $this->_itemTemplate;
199 199
 				}
200 200
 			}
201 201
 			else
202 202
 			{
203
-				$template=$this->_itemTemplate;
204
-				$classPath=$this->getItemRenderer();
203
+				$template = $this->_itemTemplate;
204
+				$classPath = $this->getItemRenderer();
205 205
 			}
206
-			if($classPath!=='')
206
+			if ($classPath !== '')
207 207
 			{
208
-				$control=Prado::createComponent($classPath);
208
+				$control = Prado::createComponent($classPath);
209 209
 				$cell->getControls()->add($control);
210
-				if($control instanceof IItemDataRenderer)
210
+				if ($control instanceof IItemDataRenderer)
211 211
 				{
212 212
 					$control->setItemIndex($cell->getParent()->getItemIndex());
213 213
 					$control->setItemType($itemType);
214 214
 				}
215
-				if($control instanceof IDataRenderer)
216
-					$control->attachEventHandler('OnDataBinding',array($this,'dataBindColumn'));
215
+				if ($control instanceof IDataRenderer)
216
+					$control->attachEventHandler('OnDataBinding', array($this, 'dataBindColumn'));
217 217
 			}
218
-			else if($template!==null)
218
+			else if ($template !== null)
219 219
 				$template->instantiateIn($cell);
220
-			else if($itemType!==TListItemType::EditItem)
220
+			else if ($itemType !== TListItemType::EditItem)
221 221
 				$cell->setText('&nbsp;');
222 222
 		}
223
-		else if($itemType===TListItemType::Header)
223
+		else if ($itemType === TListItemType::Header)
224 224
 		{
225
-			if(($classPath=$this->getHeaderRenderer())!=='')
226
-				$this->initializeHeaderCell($cell,$columnIndex);
227
-			else if($this->_headerTemplate!==null)
225
+			if (($classPath = $this->getHeaderRenderer()) !== '')
226
+				$this->initializeHeaderCell($cell, $columnIndex);
227
+			else if ($this->_headerTemplate !== null)
228 228
 				$this->_headerTemplate->instantiateIn($cell);
229 229
 			else
230
-				$this->initializeHeaderCell($cell,$columnIndex);
230
+				$this->initializeHeaderCell($cell, $columnIndex);
231 231
 		}
232
-		else if($itemType===TListItemType::Footer)
232
+		else if ($itemType === TListItemType::Footer)
233 233
 		{
234
-			if(($classPath=$this->getFooterRenderer())!=='')
235
-				$this->initializeFooterCell($cell,$columnIndex);
236
-			else if($this->_footerTemplate!==null)
234
+			if (($classPath = $this->getFooterRenderer()) !== '')
235
+				$this->initializeFooterCell($cell, $columnIndex);
236
+			else if ($this->_footerTemplate !== null)
237 237
 				$this->_footerTemplate->instantiateIn($cell);
238 238
 			else
239
-				$this->initializeFooterCell($cell,$columnIndex);
239
+				$this->initializeFooterCell($cell, $columnIndex);
240 240
 		}
241 241
 	}
242 242
 
@@ -245,9 +245,9 @@  discard block
 block discarded – undo
245 245
 	 * This method is invoked when datagrid performs databinding.
246 246
 	 * It populates the content of the cell with the relevant data from data source.
247 247
 	 */
248
-	public function dataBindColumn($sender,$param)
248
+	public function dataBindColumn($sender, $param)
249 249
 	{
250
-		$item=$sender->getNamingContainer();
250
+		$item = $sender->getNamingContainer();
251 251
 		$sender->setData($item->getData());
252 252
 	}
253 253
 }
Please login to merge, or discard this patch.
Braces   +44 added lines, -40 removed lines patch added patch discarded remove patch
@@ -111,10 +111,11 @@  discard block
 block discarded – undo
111 111
 	 */
112 112
 	public function setEditItemTemplate($value)
113 113
 	{
114
-		if($value instanceof ITemplate || $value===null)
115
-			$this->_editItemTemplate=$value;
116
-		else
117
-			throw new TInvalidDataTypeException('templatecolumn_template_required','EditItemTemplate');
114
+		if($value instanceof ITemplate || $value===null) {
115
+					$this->_editItemTemplate=$value;
116
+		} else {
117
+					throw new TInvalidDataTypeException('templatecolumn_template_required','EditItemTemplate');
118
+		}
118 119
 	}
119 120
 
120 121
 	/**
@@ -131,10 +132,11 @@  discard block
 block discarded – undo
131 132
 	 */
132 133
 	public function setItemTemplate($value)
133 134
 	{
134
-		if($value instanceof ITemplate || $value===null)
135
-			$this->_itemTemplate=$value;
136
-		else
137
-			throw new TInvalidDataTypeException('templatecolumn_template_required','ItemTemplate');
135
+		if($value instanceof ITemplate || $value===null) {
136
+					$this->_itemTemplate=$value;
137
+		} else {
138
+					throw new TInvalidDataTypeException('templatecolumn_template_required','ItemTemplate');
139
+		}
138 140
 	}
139 141
 
140 142
 	/**
@@ -151,10 +153,11 @@  discard block
 block discarded – undo
151 153
 	 */
152 154
 	public function setHeaderTemplate($value)
153 155
 	{
154
-		if($value instanceof ITemplate || $value===null)
155
-			$this->_headerTemplate=$value;
156
-		else
157
-			throw new TInvalidDataTypeException('templatecolumn_template_required','HeaderTemplate');
156
+		if($value instanceof ITemplate || $value===null) {
157
+					$this->_headerTemplate=$value;
158
+		} else {
159
+					throw new TInvalidDataTypeException('templatecolumn_template_required','HeaderTemplate');
160
+		}
158 161
 	}
159 162
 
160 163
 	/**
@@ -171,10 +174,11 @@  discard block
 block discarded – undo
171 174
 	 */
172 175
 	public function setFooterTemplate($value)
173 176
 	{
174
-		if($value instanceof ITemplate || $value===null)
175
-			$this->_footerTemplate=$value;
176
-		else
177
-			throw new TInvalidDataTypeException('templatecolumn_template_required','FooterTemplate');
177
+		if($value instanceof ITemplate || $value===null) {
178
+					$this->_footerTemplate=$value;
179
+		} else {
180
+					throw new TInvalidDataTypeException('templatecolumn_template_required','FooterTemplate');
181
+		}
178 182
 	}
179 183
 
180 184
 	/**
@@ -197,8 +201,7 @@  discard block
 block discarded – undo
197 201
 					$classPath=$this->getItemRenderer();
198 202
 					$template=$this->_itemTemplate;
199 203
 				}
200
-			}
201
-			else
204
+			} else
202 205
 			{
203 206
 				$template=$this->_itemTemplate;
204 207
 				$classPath=$this->getItemRenderer();
@@ -212,31 +215,32 @@  discard block
 block discarded – undo
212 215
 					$control->setItemIndex($cell->getParent()->getItemIndex());
213 216
 					$control->setItemType($itemType);
214 217
 				}
215
-				if($control instanceof IDataRenderer)
216
-					$control->attachEventHandler('OnDataBinding',array($this,'dataBindColumn'));
218
+				if($control instanceof IDataRenderer) {
219
+									$control->attachEventHandler('OnDataBinding',array($this,'dataBindColumn'));
220
+				}
221
+			} else if($template!==null) {
222
+							$template->instantiateIn($cell);
223
+			} else if($itemType!==TListItemType::EditItem) {
224
+							$cell->setText('&nbsp;');
217 225
 			}
218
-			else if($template!==null)
219
-				$template->instantiateIn($cell);
220
-			else if($itemType!==TListItemType::EditItem)
221
-				$cell->setText('&nbsp;');
222
-		}
223
-		else if($itemType===TListItemType::Header)
226
+		} else if($itemType===TListItemType::Header)
224 227
 		{
225
-			if(($classPath=$this->getHeaderRenderer())!=='')
226
-				$this->initializeHeaderCell($cell,$columnIndex);
227
-			else if($this->_headerTemplate!==null)
228
-				$this->_headerTemplate->instantiateIn($cell);
229
-			else
230
-				$this->initializeHeaderCell($cell,$columnIndex);
231
-		}
232
-		else if($itemType===TListItemType::Footer)
228
+			if(($classPath=$this->getHeaderRenderer())!=='') {
229
+							$this->initializeHeaderCell($cell,$columnIndex);
230
+			} else if($this->_headerTemplate!==null) {
231
+							$this->_headerTemplate->instantiateIn($cell);
232
+			} else {
233
+							$this->initializeHeaderCell($cell,$columnIndex);
234
+			}
235
+		} else if($itemType===TListItemType::Footer)
233 236
 		{
234
-			if(($classPath=$this->getFooterRenderer())!=='')
235
-				$this->initializeFooterCell($cell,$columnIndex);
236
-			else if($this->_footerTemplate!==null)
237
-				$this->_footerTemplate->instantiateIn($cell);
238
-			else
239
-				$this->initializeFooterCell($cell,$columnIndex);
237
+			if(($classPath=$this->getFooterRenderer())!=='') {
238
+							$this->initializeFooterCell($cell,$columnIndex);
239
+			} else if($this->_footerTemplate!==null) {
240
+							$this->_footerTemplate->instantiateIn($cell);
241
+			} else {
242
+							$this->initializeFooterCell($cell,$columnIndex);
243
+			}
240 244
 		}
241 245
 	}
242 246
 
Please login to merge, or discard this patch.
framework/Web/UI/WebControls/TTextBox.php 4 patches
Doc Comments   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -237,7 +237,7 @@  discard block
 block discarded – undo
237 237
 	/**
238 238
 	 * Returns the value to be validated.
239 239
 	 * This methid is required by IValidatable interface.
240
-	 * @return mixed the value of the property to be validated.
240
+	 * @return string the value of the property to be validated.
241 241
 	 */
242 242
 	public function getValidationPropertyValue()
243 243
 	{
@@ -342,6 +342,7 @@  discard block
 block discarded – undo
342 342
 	 * An automatic postback to the server will occur whenever the user
343 343
 	 * modifies the text in the TTextBox control and then tabs out of the component.
344 344
 	 * @param boolean the value indicating if postback automatically
345
+	 * @param boolean $value
345 346
 	 */
346 347
 	public function setAutoPostBack($value)
347 348
 	{
@@ -425,6 +426,7 @@  discard block
 block discarded – undo
425 426
 
426 427
 	/**
427 428
 	 * @param boolean whether the textbox is read only
429
+	 * @param boolean $value
428 430
 	 */
429 431
 	public function setReadOnly($value)
430 432
 	{
Please login to merge, or discard this patch.
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -251,14 +251,14 @@  discard block
 block discarded – undo
251 251
 	 */
252 252
 	public function getIsValid()
253 253
 	{
254
-	    return $this->_isValid;
254
+		return $this->_isValid;
255 255
 	}
256 256
 	/**
257 257
 	 * @param bool wether this control is valid.
258 258
 	 */
259 259
 	public function setIsValid($value)
260 260
 	{
261
-	    $this->_isValid=TPropertyValue::ensureBoolean($value);
261
+		$this->_isValid=TPropertyValue::ensureBoolean($value);
262 262
 	}
263 263
 
264 264
 	/**
@@ -329,8 +329,8 @@  discard block
 block discarded – undo
329 329
 
330 330
 	/**
331 331
 	 * @return boolean a value indicating whether an automatic postback to the server
332
-     * will occur whenever the user modifies the text in the TTextBox control and
333
-     * then tabs out of the component. Defaults to false.
332
+	 * will occur whenever the user modifies the text in the TTextBox control and
333
+	 * then tabs out of the component. Defaults to false.
334 334
 	 */
335 335
 	public function getAutoPostBack()
336 336
 	{
Please login to merge, or discard this patch.
Spacing   +130 added lines, -130 removed lines patch added patch discarded remove patch
@@ -51,28 +51,28 @@  discard block
 block discarded – undo
51 51
 	/**
52 52
 	 * Default number of rows (for MultiLine text box)
53 53
 	 */
54
-	const DEFAULT_ROWS=4;
54
+	const DEFAULT_ROWS = 4;
55 55
 	/**
56 56
 	 * Default number of columns (for MultiLine text box)
57 57
 	 */
58
-	const DEFAULT_COLUMNS=20;
58
+	const DEFAULT_COLUMNS = 20;
59 59
 	/**
60 60
 	 * @var mixed safe text parser
61 61
 	 */
62
-	private static $_safeTextParser=null;
62
+	private static $_safeTextParser = null;
63 63
 	/**
64 64
 	 * @var string safe textbox content with javascript stripped off
65 65
 	 */
66 66
 	private $_safeText;
67
-	private $_dataChanged=false;
68
-	private $_isValid=true;
67
+	private $_dataChanged = false;
68
+	private $_isValid = true;
69 69
 
70 70
 	/**
71 71
 	 * @return string tag name of the textbox
72 72
 	 */
73 73
 	protected function getTagName()
74 74
 	{
75
-		return ($this->getTextMode()==='MultiLine')?'textarea':'input';
75
+		return ($this->getTextMode() === 'MultiLine') ? 'textarea' : 'input';
76 76
 	}
77 77
 
78 78
 	/**
@@ -80,7 +80,7 @@  discard block
 block discarded – undo
80 80
 	 */
81 81
 	public function getEnableClientScript()
82 82
 	{
83
-		return $this->getViewState('EnableClientScript',true);
83
+		return $this->getViewState('EnableClientScript', true);
84 84
 	}
85 85
 
86 86
 	/**
@@ -88,7 +88,7 @@  discard block
 block discarded – undo
88 88
 	 */
89 89
 	public function setEnableClientScript($value)
90 90
 	{
91
-		$this->setViewState('EnableClientScript',TPropertyValue::ensureBoolean($value),true);
91
+		$this->setViewState('EnableClientScript', TPropertyValue::ensureBoolean($value), true);
92 92
 	}
93 93
 
94 94
 	/**
@@ -98,69 +98,69 @@  discard block
 block discarded – undo
98 98
 	 */
99 99
 	protected function addAttributesToRender($writer)
100 100
 	{
101
-		$page=$this->getPage();
101
+		$page = $this->getPage();
102 102
 		$page->ensureRenderInForm($this);
103
-		if(($uid=$this->getUniqueID())!=='')
104
-			$writer->addAttribute('name',$uid);
105
-		if(($textMode=$this->getTextMode())===TTextBoxMode::MultiLine)
103
+		if (($uid = $this->getUniqueID()) !== '')
104
+			$writer->addAttribute('name', $uid);
105
+		if (($textMode = $this->getTextMode()) === TTextBoxMode::MultiLine)
106 106
 		{
107
-			if(($rows=$this->getRows())<=0)
108
-				$rows=self::DEFAULT_ROWS;
109
-			if(($cols=$this->getColumns())<=0)
110
-				$cols=self::DEFAULT_COLUMNS;
111
-			$writer->addAttribute('rows',"$rows");
112
-			$writer->addAttribute('cols',"$cols");
113
-			if(!$this->getWrap())
114
-				$writer->addAttribute('wrap','off');
107
+			if (($rows = $this->getRows()) <= 0)
108
+				$rows = self::DEFAULT_ROWS;
109
+			if (($cols = $this->getColumns()) <= 0)
110
+				$cols = self::DEFAULT_COLUMNS;
111
+			$writer->addAttribute('rows', "$rows");
112
+			$writer->addAttribute('cols', "$cols");
113
+			if (!$this->getWrap())
114
+				$writer->addAttribute('wrap', 'off');
115 115
 		}
116 116
 		else
117 117
 		{
118
-			if($textMode===TTextBoxMode::SingleLine)
118
+			if ($textMode === TTextBoxMode::SingleLine)
119 119
 			{
120
-				$writer->addAttribute('type','text');
121
-				if(($text=$this->getText())!=='')
122
-					$writer->addAttribute('value',$text);
120
+				$writer->addAttribute('type', 'text');
121
+				if (($text = $this->getText()) !== '')
122
+					$writer->addAttribute('value', $text);
123 123
 			}
124 124
 			else
125 125
 			{
126
-				if($this->getPersistPassword() && ($text=$this->getText())!=='')
127
-					$writer->addAttribute('value',$text);
128
-				$writer->addAttribute('type','password');
126
+				if ($this->getPersistPassword() && ($text = $this->getText()) !== '')
127
+					$writer->addAttribute('value', $text);
128
+				$writer->addAttribute('type', 'password');
129 129
 			}
130 130
 
131
-			if(($act=$this->getAutoCompleteType())!=='None')
131
+			if (($act = $this->getAutoCompleteType()) !== 'None')
132 132
 			{
133
-				if($act==='Disabled')
134
-					$writer->addAttribute('autocomplete','off');
135
-				else if($act==='Search')
136
-					$writer->addAttribute('vcard_name','search');
137
-				else if($act==='HomeCountryRegion')
138
-					$writer->addAttribute('vcard_name','HomeCountry');
139
-				else if($act==='BusinessCountryRegion')
140
-					$writer->addAttribute('vcard_name','BusinessCountry');
133
+				if ($act === 'Disabled')
134
+					$writer->addAttribute('autocomplete', 'off');
135
+				else if ($act === 'Search')
136
+					$writer->addAttribute('vcard_name', 'search');
137
+				else if ($act === 'HomeCountryRegion')
138
+					$writer->addAttribute('vcard_name', 'HomeCountry');
139
+				else if ($act === 'BusinessCountryRegion')
140
+					$writer->addAttribute('vcard_name', 'BusinessCountry');
141 141
 				else
142 142
 				{
143
-					if(strpos($act,'Business')===0)
144
-						$act='Business'.'.'.substr($act,8);
145
-					else if(strpos($act,'Home')===0)
146
-						$act='Home'.'.'.substr($act,4);
147
-					$writer->addAttribute('vcard_name','vCard.'.$act);
143
+					if (strpos($act, 'Business') === 0)
144
+						$act = 'Business' . '.' . substr($act, 8);
145
+					else if (strpos($act, 'Home') === 0)
146
+						$act = 'Home' . '.' . substr($act, 4);
147
+					$writer->addAttribute('vcard_name', 'vCard.' . $act);
148 148
 				}
149 149
 			}
150 150
 
151
-			if(($cols=$this->getColumns())>0)
152
-				$writer->addAttribute('size',"$cols");
153
-			if(($maxLength=$this->getMaxLength())>0)
154
-				$writer->addAttribute('maxlength',"$maxLength");
151
+			if (($cols = $this->getColumns()) > 0)
152
+				$writer->addAttribute('size', "$cols");
153
+			if (($maxLength = $this->getMaxLength()) > 0)
154
+				$writer->addAttribute('maxlength', "$maxLength");
155 155
 		}
156
-		if($this->getReadOnly())
157
-			$writer->addAttribute('readonly','readonly');
158
-		$isEnabled=$this->getEnabled(true);
159
-		if(!$isEnabled && $this->getEnabled())  // in this case parent will not render 'disabled'
160
-			$writer->addAttribute('disabled','disabled');
161
-		if($isEnabled
156
+		if ($this->getReadOnly())
157
+			$writer->addAttribute('readonly', 'readonly');
158
+		$isEnabled = $this->getEnabled(true);
159
+		if (!$isEnabled && $this->getEnabled())  // in this case parent will not render 'disabled'
160
+			$writer->addAttribute('disabled', 'disabled');
161
+		if ($isEnabled
162 162
 			&& $this->getEnableClientScript()
163
-			&& ( $this->getAutoPostBack() || $textMode===TTextBoxMode::SingleLine)
163
+			&& ($this->getAutoPostBack() || $textMode === TTextBoxMode::SingleLine)
164 164
 			&& $page->getClientSupportsJavaScript())
165 165
 		{
166 166
 			$this->renderClientControlScript($writer);
@@ -173,9 +173,9 @@  discard block
 block discarded – undo
173 173
 	 */
174 174
 	protected function renderClientControlScript($writer)
175 175
 	{
176
-		$writer->addAttribute('id',$this->getClientID());
176
+		$writer->addAttribute('id', $this->getClientID());
177 177
 		$cs = $this->getPage()->getClientScript();
178
-		$cs->registerPostBackControl($this->getClientClassName(),$this->getPostBackOptions());
178
+		$cs->registerPostBackControl($this->getClientClassName(), $this->getPostBackOptions());
179 179
 	}
180 180
 
181 181
 	/**
@@ -210,15 +210,15 @@  discard block
 block discarded – undo
210 210
 	 * @param array the input data collection
211 211
 	 * @return boolean whether the data of the component has been changed
212 212
 	 */
213
-	public function loadPostData($key,$values)
213
+	public function loadPostData($key, $values)
214 214
 	{
215
-		$value=$values[$key];
216
-		if($this->getAutoTrim())
217
-			$value=trim($value);
218
-		if(!$this->getReadOnly() && $this->getText()!==$value)
215
+		$value = $values[$key];
216
+		if ($this->getAutoTrim())
217
+			$value = trim($value);
218
+		if (!$this->getReadOnly() && $this->getText() !== $value)
219 219
 		{
220 220
 			$this->setText($value);
221
-			return $this->_dataChanged=true;
221
+			return $this->_dataChanged = true;
222 222
 		}
223 223
 		else
224 224
 			return false;
@@ -258,7 +258,7 @@  discard block
 block discarded – undo
258 258
 	 */
259 259
 	public function setIsValid($value)
260 260
 	{
261
-	    $this->_isValid=TPropertyValue::ensureBoolean($value);
261
+	    $this->_isValid = TPropertyValue::ensureBoolean($value);
262 262
 	}
263 263
 
264 264
 	/**
@@ -271,7 +271,7 @@  discard block
 block discarded – undo
271 271
 	 */
272 272
 	public function onTextChanged($param)
273 273
 	{
274
-		$this->raiseEvent('OnTextChanged',$this,$param);
274
+		$this->raiseEvent('OnTextChanged', $this, $param);
275 275
 	}
276 276
 
277 277
 	/**
@@ -283,7 +283,7 @@  discard block
 block discarded – undo
283 283
 	 */
284 284
 	public function raisePostDataChangedEvent()
285 285
 	{
286
-		if($this->getAutoPostBack() && $this->getCausesValidation())
286
+		if ($this->getAutoPostBack() && $this->getCausesValidation())
287 287
 			$this->getPage()->validate($this->getValidationGroup());
288 288
 		$this->onTextChanged(null);
289 289
 	}
@@ -294,7 +294,7 @@  discard block
 block discarded – undo
294 294
 	 */
295 295
 	public function renderContents($writer)
296 296
 	{
297
-		if($this->getTextMode()==='MultiLine')
297
+		if ($this->getTextMode() === 'MultiLine')
298 298
 			$writer->write(THttpUtility::htmlEncode($this->getText()));
299 299
 	}
300 300
 
@@ -306,7 +306,7 @@  discard block
 block discarded – undo
306 306
 	public function renderBeginTag($writer)
307 307
 	{
308 308
 		parent::renderBeginTag($writer);
309
-		if($this->getTextMode()==='MultiLine')
309
+		if ($this->getTextMode() === 'MultiLine')
310 310
 			$writer->write("\n");
311 311
 	}
312 312
 
@@ -315,7 +315,7 @@  discard block
 block discarded – undo
315 315
 	 */
316 316
 	public function getAutoCompleteType()
317 317
 	{
318
-		return $this->getViewState('AutoCompleteType',TTextBoxAutoCompleteType::None);
318
+		return $this->getViewState('AutoCompleteType', TTextBoxAutoCompleteType::None);
319 319
 	}
320 320
 
321 321
 	/**
@@ -324,7 +324,7 @@  discard block
 block discarded – undo
324 324
 	 */
325 325
 	public function setAutoCompleteType($value)
326 326
 	{
327
-		$this->setViewState('AutoCompleteType',TPropertyValue::ensureEnum($value,'TTextBoxAutoCompleteType'),TTextBoxAutoCompleteType::None);
327
+		$this->setViewState('AutoCompleteType', TPropertyValue::ensureEnum($value, 'TTextBoxAutoCompleteType'), TTextBoxAutoCompleteType::None);
328 328
 	}
329 329
 
330 330
 	/**
@@ -334,7 +334,7 @@  discard block
 block discarded – undo
334 334
 	 */
335 335
 	public function getAutoPostBack()
336 336
 	{
337
-		return $this->getViewState('AutoPostBack',false);
337
+		return $this->getViewState('AutoPostBack', false);
338 338
 	}
339 339
 
340 340
 	/**
@@ -345,7 +345,7 @@  discard block
 block discarded – undo
345 345
 	 */
346 346
 	public function setAutoPostBack($value)
347 347
 	{
348
-		$this->setViewState('AutoPostBack',TPropertyValue::ensureBoolean($value),false);
348
+		$this->setViewState('AutoPostBack', TPropertyValue::ensureBoolean($value), false);
349 349
 	}
350 350
 
351 351
 	/**
@@ -353,7 +353,7 @@  discard block
 block discarded – undo
353 353
 	 */
354 354
 	public function getAutoTrim()
355 355
 	{
356
-		return $this->getViewState('AutoTrim',false);
356
+		return $this->getViewState('AutoTrim', false);
357 357
 	}
358 358
 
359 359
 	/**
@@ -362,7 +362,7 @@  discard block
 block discarded – undo
362 362
 	 */
363 363
 	public function setAutoTrim($value)
364 364
 	{
365
-		$this->setViewState('AutoTrim',TPropertyValue::ensureBoolean($value),false);
365
+		$this->setViewState('AutoTrim', TPropertyValue::ensureBoolean($value), false);
366 366
 	}
367 367
 
368 368
 	/**
@@ -370,7 +370,7 @@  discard block
 block discarded – undo
370 370
 	 */
371 371
 	public function getCausesValidation()
372 372
 	{
373
-		return $this->getViewState('CausesValidation',true);
373
+		return $this->getViewState('CausesValidation', true);
374 374
 	}
375 375
 
376 376
 	/**
@@ -378,7 +378,7 @@  discard block
 block discarded – undo
378 378
 	 */
379 379
 	public function setCausesValidation($value)
380 380
 	{
381
-		$this->setViewState('CausesValidation',TPropertyValue::ensureBoolean($value),true);
381
+		$this->setViewState('CausesValidation', TPropertyValue::ensureBoolean($value), true);
382 382
 	}
383 383
 
384 384
 	/**
@@ -386,7 +386,7 @@  discard block
 block discarded – undo
386 386
 	 */
387 387
 	public function getColumns()
388 388
 	{
389
-		return $this->getViewState('Columns',0);
389
+		return $this->getViewState('Columns', 0);
390 390
 	}
391 391
 
392 392
 	/**
@@ -395,7 +395,7 @@  discard block
 block discarded – undo
395 395
 	 */
396 396
 	public function setColumns($value)
397 397
 	{
398
-		$this->setViewState('Columns',TPropertyValue::ensureInteger($value),0);
398
+		$this->setViewState('Columns', TPropertyValue::ensureInteger($value), 0);
399 399
 	}
400 400
 
401 401
 	/**
@@ -403,7 +403,7 @@  discard block
 block discarded – undo
403 403
 	 */
404 404
 	public function getMaxLength()
405 405
 	{
406
-		return $this->getViewState('MaxLength',0);
406
+		return $this->getViewState('MaxLength', 0);
407 407
 	}
408 408
 
409 409
 	/**
@@ -412,7 +412,7 @@  discard block
 block discarded – undo
412 412
 	 */
413 413
 	public function setMaxLength($value)
414 414
 	{
415
-		$this->setViewState('MaxLength',TPropertyValue::ensureInteger($value),0);
415
+		$this->setViewState('MaxLength', TPropertyValue::ensureInteger($value), 0);
416 416
 	}
417 417
 
418 418
 	/**
@@ -420,7 +420,7 @@  discard block
 block discarded – undo
420 420
 	 */
421 421
 	public function getReadOnly()
422 422
 	{
423
-		return $this->getViewState('ReadOnly',false);
423
+		return $this->getViewState('ReadOnly', false);
424 424
 	}
425 425
 
426 426
 	/**
@@ -428,7 +428,7 @@  discard block
 block discarded – undo
428 428
 	 */
429 429
 	public function setReadOnly($value)
430 430
 	{
431
-		$this->setViewState('ReadOnly',TPropertyValue::ensureBoolean($value),false);
431
+		$this->setViewState('ReadOnly', TPropertyValue::ensureBoolean($value), false);
432 432
 	}
433 433
 
434 434
 	/**
@@ -436,7 +436,7 @@  discard block
 block discarded – undo
436 436
 	 */
437 437
 	public function getRows()
438 438
 	{
439
-		return $this->getViewState('Rows',self::DEFAULT_ROWS);
439
+		return $this->getViewState('Rows', self::DEFAULT_ROWS);
440 440
 	}
441 441
 
442 442
 	/**
@@ -445,7 +445,7 @@  discard block
 block discarded – undo
445 445
 	 */
446 446
 	public function setRows($value)
447 447
 	{
448
-		$this->setViewState('Rows',TPropertyValue::ensureInteger($value),self::DEFAULT_ROWS);
448
+		$this->setViewState('Rows', TPropertyValue::ensureInteger($value), self::DEFAULT_ROWS);
449 449
 	}
450 450
 
451 451
 	/**
@@ -453,7 +453,7 @@  discard block
 block discarded – undo
453 453
 	 */
454 454
 	public function getPersistPassword()
455 455
 	{
456
-		return $this->getViewState('PersistPassword',false);
456
+		return $this->getViewState('PersistPassword', false);
457 457
 	}
458 458
 
459 459
 	/**
@@ -461,7 +461,7 @@  discard block
 block discarded – undo
461 461
 	 */
462 462
 	public function setPersistPassword($value)
463 463
 	{
464
-		$this->setViewState('PersistPassword',TPropertyValue::ensureBoolean($value),false);
464
+		$this->setViewState('PersistPassword', TPropertyValue::ensureBoolean($value), false);
465 465
 	}
466 466
 
467 467
 	/**
@@ -469,7 +469,7 @@  discard block
 block discarded – undo
469 469
 	 */
470 470
 	public function getText()
471 471
 	{
472
-		return $this->getViewState('Text','');
472
+		return $this->getViewState('Text', '');
473 473
 	}
474 474
 
475 475
 	/**
@@ -478,7 +478,7 @@  discard block
 block discarded – undo
478 478
 	 */
479 479
 	public function setText($value)
480 480
 	{
481
-		$this->setViewState('Text',TPropertyValue::ensureString($value),'');
481
+		$this->setViewState('Text', TPropertyValue::ensureString($value), '');
482 482
 		$this->_safeText = null;
483 483
 	}
484 484
 
@@ -513,8 +513,8 @@  discard block
 block discarded – undo
513 513
 	 */
514 514
 	public function getSafeText()
515 515
 	{
516
-		if($this->_safeText===null)
517
-			$this->_safeText=$this->getSafeTextParser()->parse($this->getText());
516
+		if ($this->_safeText === null)
517
+			$this->_safeText = $this->getSafeTextParser()->parse($this->getText());
518 518
 		return $this->_safeText;
519 519
 	}
520 520
 
@@ -523,8 +523,8 @@  discard block
 block discarded – undo
523 523
 	 */
524 524
 	protected function getSafeTextParser()
525 525
 	{
526
-		if(!self::$_safeTextParser)
527
-			self::$_safeTextParser=Prado::createComponent('System.3rdParty.SafeHtml.TSafeHtmlParser');
526
+		if (!self::$_safeTextParser)
527
+			self::$_safeTextParser = Prado::createComponent('System.3rdParty.SafeHtml.TSafeHtmlParser');
528 528
 		return self::$_safeTextParser;
529 529
 	}
530 530
 
@@ -533,7 +533,7 @@  discard block
 block discarded – undo
533 533
 	 */
534 534
 	public function getTextMode()
535 535
 	{
536
-		return $this->getViewState('TextMode',TTextBoxMode::SingleLine);
536
+		return $this->getViewState('TextMode', TTextBoxMode::SingleLine);
537 537
 	}
538 538
 
539 539
 	/**
@@ -543,7 +543,7 @@  discard block
 block discarded – undo
543 543
 	 */
544 544
 	public function setTextMode($value)
545 545
 	{
546
-		$this->setViewState('TextMode',TPropertyValue::ensureEnum($value,'TTextBoxMode'),TTextBoxMode::SingleLine);
546
+		$this->setViewState('TextMode', TPropertyValue::ensureEnum($value, 'TTextBoxMode'), TTextBoxMode::SingleLine);
547 547
 	}
548 548
 
549 549
 	/**
@@ -551,7 +551,7 @@  discard block
 block discarded – undo
551 551
 	 */
552 552
 	public function getValidationGroup()
553 553
 	{
554
-		return $this->getViewState('ValidationGroup','');
554
+		return $this->getViewState('ValidationGroup', '');
555 555
 	}
556 556
 
557 557
 	/**
@@ -559,7 +559,7 @@  discard block
 block discarded – undo
559 559
 	 */
560 560
 	public function setValidationGroup($value)
561 561
 	{
562
-		$this->setViewState('ValidationGroup',$value,'');
562
+		$this->setViewState('ValidationGroup', $value, '');
563 563
 	}
564 564
 
565 565
 	/**
@@ -567,7 +567,7 @@  discard block
 block discarded – undo
567 567
 	 */
568 568
 	public function getWrap()
569 569
 	{
570
-		return $this->getViewState('Wrap',true);
570
+		return $this->getViewState('Wrap', true);
571 571
 	}
572 572
 
573 573
 	/**
@@ -576,7 +576,7 @@  discard block
 block discarded – undo
576 576
 	 */
577 577
 	public function setWrap($value)
578 578
 	{
579
-		$this->setViewState('Wrap',TPropertyValue::ensureBoolean($value),true);
579
+		$this->setViewState('Wrap', TPropertyValue::ensureBoolean($value), true);
580 580
 	}
581 581
 }
582 582
 
@@ -596,9 +596,9 @@  discard block
 block discarded – undo
596 596
  */
597 597
 class TTextBoxMode extends TEnumerable
598 598
 {
599
-	const SingleLine='SingleLine';
600
-	const MultiLine='MultiLine';
601
-	const Password='Password';
599
+	const SingleLine = 'SingleLine';
600
+	const MultiLine = 'MultiLine';
601
+	const Password = 'Password';
602 602
 }
603 603
 
604 604
 /**
@@ -612,37 +612,37 @@  discard block
 block discarded – undo
612 612
  */
613 613
 class TTextBoxAutoCompleteType extends TEnumerable
614 614
 {
615
-	const BusinessCity='BusinessCity';
616
-	const BusinessCountryRegion='BusinessCountryRegion';
617
-	const BusinessFax='BusinessFax';
618
-	const BusinessPhone='BusinessPhone';
619
-	const BusinessState='BusinessState';
620
-	const BusinessStreetAddress='BusinessStreetAddress';
621
-	const BusinessUrl='BusinessUrl';
622
-	const BusinessZipCode='BusinessZipCode';
623
-	const Cellular='Cellular';
624
-	const Company='Company';
625
-	const Department='Department';
626
-	const Disabled='Disabled';
627
-	const DisplayName='DisplayName';
628
-	const Email='Email';
629
-	const FirstName='FirstName';
630
-	const Gender='Gender';
631
-	const HomeCity='HomeCity';
632
-	const HomeCountryRegion='HomeCountryRegion';
633
-	const HomeFax='HomeFax';
634
-	const Homepage='Homepage';
635
-	const HomePhone='HomePhone';
636
-	const HomeState='HomeState';
637
-	const HomeStreetAddress='HomeStreetAddress';
638
-	const HomeZipCode='HomeZipCode';
639
-	const JobTitle='JobTitle';
640
-	const LastName='LastName';
641
-	const MiddleName='MiddleName';
642
-	const None='None';
643
-	const Notes='Notes';
644
-	const Office='Office';
645
-	const Pager='Pager';
646
-	const Search='Search';
615
+	const BusinessCity = 'BusinessCity';
616
+	const BusinessCountryRegion = 'BusinessCountryRegion';
617
+	const BusinessFax = 'BusinessFax';
618
+	const BusinessPhone = 'BusinessPhone';
619
+	const BusinessState = 'BusinessState';
620
+	const BusinessStreetAddress = 'BusinessStreetAddress';
621
+	const BusinessUrl = 'BusinessUrl';
622
+	const BusinessZipCode = 'BusinessZipCode';
623
+	const Cellular = 'Cellular';
624
+	const Company = 'Company';
625
+	const Department = 'Department';
626
+	const Disabled = 'Disabled';
627
+	const DisplayName = 'DisplayName';
628
+	const Email = 'Email';
629
+	const FirstName = 'FirstName';
630
+	const Gender = 'Gender';
631
+	const HomeCity = 'HomeCity';
632
+	const HomeCountryRegion = 'HomeCountryRegion';
633
+	const HomeFax = 'HomeFax';
634
+	const Homepage = 'Homepage';
635
+	const HomePhone = 'HomePhone';
636
+	const HomeState = 'HomeState';
637
+	const HomeStreetAddress = 'HomeStreetAddress';
638
+	const HomeZipCode = 'HomeZipCode';
639
+	const JobTitle = 'JobTitle';
640
+	const LastName = 'LastName';
641
+	const MiddleName = 'MiddleName';
642
+	const None = 'None';
643
+	const Notes = 'Notes';
644
+	const Office = 'Office';
645
+	const Pager = 'Pager';
646
+	const Search = 'Search';
647 647
 }
648 648
 
Please login to merge, or discard this patch.
Braces   +66 added lines, -50 removed lines patch added patch discarded remove patch
@@ -100,64 +100,74 @@  discard block
 block discarded – undo
100 100
 	{
101 101
 		$page=$this->getPage();
102 102
 		$page->ensureRenderInForm($this);
103
-		if(($uid=$this->getUniqueID())!=='')
104
-			$writer->addAttribute('name',$uid);
103
+		if(($uid=$this->getUniqueID())!=='') {
104
+					$writer->addAttribute('name',$uid);
105
+		}
105 106
 		if(($textMode=$this->getTextMode())===TTextBoxMode::MultiLine)
106 107
 		{
107
-			if(($rows=$this->getRows())<=0)
108
-				$rows=self::DEFAULT_ROWS;
109
-			if(($cols=$this->getColumns())<=0)
110
-				$cols=self::DEFAULT_COLUMNS;
108
+			if(($rows=$this->getRows())<=0) {
109
+							$rows=self::DEFAULT_ROWS;
110
+			}
111
+			if(($cols=$this->getColumns())<=0) {
112
+							$cols=self::DEFAULT_COLUMNS;
113
+			}
111 114
 			$writer->addAttribute('rows',"$rows");
112 115
 			$writer->addAttribute('cols',"$cols");
113
-			if(!$this->getWrap())
114
-				$writer->addAttribute('wrap','off');
115
-		}
116
-		else
116
+			if(!$this->getWrap()) {
117
+							$writer->addAttribute('wrap','off');
118
+			}
119
+		} else
117 120
 		{
118 121
 			if($textMode===TTextBoxMode::SingleLine)
119 122
 			{
120 123
 				$writer->addAttribute('type','text');
121
-				if(($text=$this->getText())!=='')
122
-					$writer->addAttribute('value',$text);
123
-			}
124
-			else
124
+				if(($text=$this->getText())!=='') {
125
+									$writer->addAttribute('value',$text);
126
+				}
127
+			} else
125 128
 			{
126
-				if($this->getPersistPassword() && ($text=$this->getText())!=='')
127
-					$writer->addAttribute('value',$text);
129
+				if($this->getPersistPassword() && ($text=$this->getText())!=='') {
130
+									$writer->addAttribute('value',$text);
131
+				}
128 132
 				$writer->addAttribute('type','password');
129 133
 			}
130 134
 
131 135
 			if(($act=$this->getAutoCompleteType())!=='None')
132 136
 			{
133
-				if($act==='Disabled')
134
-					$writer->addAttribute('autocomplete','off');
135
-				else if($act==='Search')
136
-					$writer->addAttribute('vcard_name','search');
137
-				else if($act==='HomeCountryRegion')
138
-					$writer->addAttribute('vcard_name','HomeCountry');
139
-				else if($act==='BusinessCountryRegion')
140
-					$writer->addAttribute('vcard_name','BusinessCountry');
141
-				else
137
+				if($act==='Disabled') {
138
+									$writer->addAttribute('autocomplete','off');
139
+				} else if($act==='Search') {
140
+									$writer->addAttribute('vcard_name','search');
141
+				} else if($act==='HomeCountryRegion') {
142
+									$writer->addAttribute('vcard_name','HomeCountry');
143
+				} else if($act==='BusinessCountryRegion') {
144
+									$writer->addAttribute('vcard_name','BusinessCountry');
145
+				} else
142 146
 				{
143
-					if(strpos($act,'Business')===0)
144
-						$act='Business'.'.'.substr($act,8);
145
-					else if(strpos($act,'Home')===0)
146
-						$act='Home'.'.'.substr($act,4);
147
+					if(strpos($act,'Business')===0) {
148
+											$act='Business'.'.'.substr($act,8);
149
+					} else if(strpos($act,'Home')===0) {
150
+											$act='Home'.'.'.substr($act,4);
151
+					}
147 152
 					$writer->addAttribute('vcard_name','vCard.'.$act);
148 153
 				}
149 154
 			}
150 155
 
151
-			if(($cols=$this->getColumns())>0)
152
-				$writer->addAttribute('size',"$cols");
153
-			if(($maxLength=$this->getMaxLength())>0)
154
-				$writer->addAttribute('maxlength',"$maxLength");
156
+			if(($cols=$this->getColumns())>0) {
157
+							$writer->addAttribute('size',"$cols");
158
+			}
159
+			if(($maxLength=$this->getMaxLength())>0) {
160
+							$writer->addAttribute('maxlength',"$maxLength");
161
+			}
162
+		}
163
+		if($this->getReadOnly()) {
164
+					$writer->addAttribute('readonly','readonly');
155 165
 		}
156
-		if($this->getReadOnly())
157
-			$writer->addAttribute('readonly','readonly');
158 166
 		$isEnabled=$this->getEnabled(true);
159
-		if(!$isEnabled && $this->getEnabled())  // in this case parent will not render 'disabled'
167
+		if(!$isEnabled && $this->getEnabled()) {
168
+			// in this case parent will not render 'disabled'
160 169
 			$writer->addAttribute('disabled','disabled');
170
+		}
161 171
 		if($isEnabled
162 172
 			&& $this->getEnableClientScript()
163 173
 			&& ( $this->getAutoPostBack() || $textMode===TTextBoxMode::SingleLine)
@@ -213,15 +223,16 @@  discard block
 block discarded – undo
213 223
 	public function loadPostData($key,$values)
214 224
 	{
215 225
 		$value=$values[$key];
216
-		if($this->getAutoTrim())
217
-			$value=trim($value);
226
+		if($this->getAutoTrim()) {
227
+					$value=trim($value);
228
+		}
218 229
 		if(!$this->getReadOnly() && $this->getText()!==$value)
219 230
 		{
220 231
 			$this->setText($value);
221 232
 			return $this->_dataChanged=true;
233
+		} else {
234
+					return false;
222 235
 		}
223
-		else
224
-			return false;
225 236
 	}
226 237
 
227 238
 	/**
@@ -283,8 +294,9 @@  discard block
 block discarded – undo
283 294
 	 */
284 295
 	public function raisePostDataChangedEvent()
285 296
 	{
286
-		if($this->getAutoPostBack() && $this->getCausesValidation())
287
-			$this->getPage()->validate($this->getValidationGroup());
297
+		if($this->getAutoPostBack() && $this->getCausesValidation()) {
298
+					$this->getPage()->validate($this->getValidationGroup());
299
+		}
288 300
 		$this->onTextChanged(null);
289 301
 	}
290 302
 
@@ -294,8 +306,9 @@  discard block
 block discarded – undo
294 306
 	 */
295 307
 	public function renderContents($writer)
296 308
 	{
297
-		if($this->getTextMode()==='MultiLine')
298
-			$writer->write(THttpUtility::htmlEncode($this->getText()));
309
+		if($this->getTextMode()==='MultiLine') {
310
+					$writer->write(THttpUtility::htmlEncode($this->getText()));
311
+		}
299 312
 	}
300 313
 
301 314
 	/**
@@ -306,8 +319,9 @@  discard block
 block discarded – undo
306 319
 	public function renderBeginTag($writer)
307 320
 	{
308 321
 		parent::renderBeginTag($writer);
309
-		if($this->getTextMode()==='MultiLine')
310
-			$writer->write("\n");
322
+		if($this->getTextMode()==='MultiLine') {
323
+					$writer->write("\n");
324
+		}
311 325
 	}
312 326
 
313 327
 	/**
@@ -513,8 +527,9 @@  discard block
 block discarded – undo
513 527
 	 */
514 528
 	public function getSafeText()
515 529
 	{
516
-		if($this->_safeText===null)
517
-			$this->_safeText=$this->getSafeTextParser()->parse($this->getText());
530
+		if($this->_safeText===null) {
531
+					$this->_safeText=$this->getSafeTextParser()->parse($this->getText());
532
+		}
518 533
 		return $this->_safeText;
519 534
 	}
520 535
 
@@ -523,8 +538,9 @@  discard block
 block discarded – undo
523 538
 	 */
524 539
 	protected function getSafeTextParser()
525 540
 	{
526
-		if(!self::$_safeTextParser)
527
-			self::$_safeTextParser=Prado::createComponent('System.3rdParty.SafeHtml.TSafeHtmlParser');
541
+		if(!self::$_safeTextParser) {
542
+					self::$_safeTextParser=Prado::createComponent('System.3rdParty.SafeHtml.TSafeHtmlParser');
543
+		}
528 544
 		return self::$_safeTextParser;
529 545
 	}
530 546
 
Please login to merge, or discard this patch.
framework/Web/UI/WebControls/TTextHighlighter.php 3 patches
Doc Comments   +1 added lines patch added patch discarded remove patch
@@ -157,6 +157,7 @@
 block discarded – undo
157 157
 	 * Processes a text string.
158 158
 	 * This method is required by the parent class.
159 159
 	 * @param string text string to be processed
160
+	 * @param string $text
160 161
 	 * @return string the processed text result
161 162
 	 */
162 163
 	public function processText($text)
Please login to merge, or discard this patch.
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -9,8 +9,8 @@  discard block
 block discarded – undo
9 9
  * @package System.Web.UI.WebControls
10 10
  */
11 11
 
12
-Prado::using('System.3rdParty.TextHighlighter.Text.Highlighter',false);
13
-Prado::using('System.3rdParty.TextHighlighter.Text.Highlighter.Renderer.Html',false);
12
+Prado::using('System.3rdParty.TextHighlighter.Text.Highlighter', false);
13
+Prado::using('System.3rdParty.TextHighlighter.Text.Highlighter.Renderer.Html', false);
14 14
 Prado::using('System.Web.UI.WebControls.TTextProcessor');
15 15
 
16 16
 
@@ -35,7 +35,7 @@  discard block
 block discarded – undo
35 35
  */
36 36
 class TTextHighlighter extends TTextProcessor
37 37
 {
38
-	private static $_lineNumberStyle=array(TTextHighlighterLineNumberStyle::Li => HL_NUMBERS_LI, TTextHighlighterLineNumberStyle::Table => HL_NUMBERS_TABLE);
38
+	private static $_lineNumberStyle = array(TTextHighlighterLineNumberStyle::Li => HL_NUMBERS_LI, TTextHighlighterLineNumberStyle::Table => HL_NUMBERS_TABLE);
39 39
 
40 40
 	/**
41 41
 	 * @return string tag name of the panel
@@ -111,7 +111,7 @@  discard block
 block discarded – undo
111 111
 	 */
112 112
 	public function setLineNumberStyle($value)
113 113
 	{
114
-		$this->setViewState('LineNumberStyle', TPropertyValue::ensureEnum($value,'TTextHighlighterLineNumberStyle'));
114
+		$this->setViewState('LineNumberStyle', TPropertyValue::ensureEnum($value, 'TTextHighlighterLineNumberStyle'));
115 115
 	}
116 116
 
117 117
 	/**
@@ -146,10 +146,10 @@  discard block
 block discarded – undo
146 146
 	 */
147 147
 	protected function registerStyleSheet()
148 148
 	{
149
-		$cs=$this->getPage()->getClientScript();
150
-		$cssFile=Prado::getPathOfNamespace('System.3rdParty.TextHighlighter.highlight','.css');
151
-		$cssKey='prado:TTextHighlighter:'.$cssFile;
152
-		if(!$cs->isStyleSheetFileRegistered($cssKey))
149
+		$cs = $this->getPage()->getClientScript();
150
+		$cssFile = Prado::getPathOfNamespace('System.3rdParty.TextHighlighter.highlight', '.css');
151
+		$cssKey = 'prado:TTextHighlighter:' . $cssFile;
152
+		if (!$cs->isStyleSheetFileRegistered($cssKey))
153 153
 			$cs->registerStyleSheetFile($cssKey, $this->publishFilePath($cssFile));
154 154
 	}
155 155
 
@@ -163,16 +163,16 @@  discard block
 block discarded – undo
163 163
 	{
164 164
 		try
165 165
 		{
166
-			$highlighter=Text_Highlighter::factory($this->getLanguage());
166
+			$highlighter = Text_Highlighter::factory($this->getLanguage());
167 167
 		}
168
-		catch(Exception $e)
168
+		catch (Exception $e)
169 169
 		{
170
-			$highlighter=false;
170
+			$highlighter = false;
171 171
 		}
172
-		if($highlighter===false)
173
-			return ('<pre>'.htmlentities(trim($text)).'</pre>');
172
+		if ($highlighter === false)
173
+			return ('<pre>' . htmlentities(trim($text)) . '</pre>');
174 174
 
175
-		$options["use_language"]=true;
175
+		$options["use_language"] = true;
176 176
 		$options["tabsize"] = $this->getTabSize();
177 177
 		if ($this->getShowLineNumbers())
178 178
 			$options["numbers"] = self::$_lineNumberStyle[$this->getLineNumberStyle()];
@@ -205,6 +205,6 @@  discard block
 block discarded – undo
205 205
  */
206 206
 class TTextHighlighterLineNumberStyle extends TEnumerable
207 207
 {
208
-	const Li='Li';
209
-	const Table='Table';
208
+	const Li = 'Li';
209
+	const Table = 'Table';
210 210
 }
Please login to merge, or discard this patch.
Braces   +10 added lines, -8 removed lines patch added patch discarded remove patch
@@ -149,8 +149,9 @@  discard block
 block discarded – undo
149 149
 		$cs=$this->getPage()->getClientScript();
150 150
 		$cssFile=Prado::getPathOfNamespace('System.3rdParty.TextHighlighter.highlight','.css');
151 151
 		$cssKey='prado:TTextHighlighter:'.$cssFile;
152
-		if(!$cs->isStyleSheetFileRegistered($cssKey))
153
-			$cs->registerStyleSheetFile($cssKey, $this->publishFilePath($cssFile));
152
+		if(!$cs->isStyleSheetFileRegistered($cssKey)) {
153
+					$cs->registerStyleSheetFile($cssKey, $this->publishFilePath($cssFile));
154
+		}
154 155
 	}
155 156
 
156 157
 	/**
@@ -164,18 +165,19 @@  discard block
 block discarded – undo
164 165
 		try
165 166
 		{
166 167
 			$highlighter=Text_Highlighter::factory($this->getLanguage());
167
-		}
168
-		catch(Exception $e)
168
+		} catch(Exception $e)
169 169
 		{
170 170
 			$highlighter=false;
171 171
 		}
172
-		if($highlighter===false)
173
-			return ('<pre>'.htmlentities(trim($text)).'</pre>');
172
+		if($highlighter===false) {
173
+					return ('<pre>'.htmlentities(trim($text)).'</pre>');
174
+		}
174 175
 
175 176
 		$options["use_language"]=true;
176 177
 		$options["tabsize"] = $this->getTabSize();
177
-		if ($this->getShowLineNumbers())
178
-			$options["numbers"] = self::$_lineNumberStyle[$this->getLineNumberStyle()];
178
+		if ($this->getShowLineNumbers()) {
179
+					$options["numbers"] = self::$_lineNumberStyle[$this->getLineNumberStyle()];
180
+		}
179 181
 		$highlighter->setRenderer(new Text_Highlighter_Renderer_Html($options));
180 182
 		return $highlighter->highlight(trim($text));
181 183
 	}
Please login to merge, or discard this patch.
framework/Web/UI/WebControls/TWebControl.php 3 patches
Doc Comments   +6 added lines, -2 removed lines patch added patch discarded remove patch
@@ -55,6 +55,7 @@  discard block
 block discarded – undo
55 55
 	 * control does work with javascript and your class wants to flag that it requires an id
56 56
 	 * to operate properly.  Once set to true, it stays that way.
57 57
 	 * @param boolean pass true to enable enforcement of the tag attribute id.
58
+	 * @param boolean $value
58 59
 	 */
59 60
 	public function setEnsureId($value)
60 61
 	{
@@ -62,7 +63,7 @@  discard block
 block discarded – undo
62 63
 	}
63 64
 
64 65
 	/**
65
-	 * @return whether this web control must have an id
66
+	 * @return boolean this web control must have an id
66 67
 	 */
67 68
 	public function getEnsureId()
68 69
 	{
@@ -215,6 +216,7 @@  discard block
 block discarded – undo
215 216
 
216 217
 	/**
217 218
 	 * @param string the foreground color of the control
219
+	 * @param string $value
218 220
 	 */
219 221
 	public function setForeColor($value)
220 222
 	{
@@ -241,7 +243,7 @@  discard block
 block discarded – undo
241 243
 	}
242 244
 
243 245
 	/**
244
-	 * @return TDisplayStyle display style of the control, default is TDisplayStyle::Fixed
246
+	 * @return string display style of the control, default is TDisplayStyle::Fixed
245 247
 	 */
246 248
 	public function getDisplay()
247 249
 	{
@@ -269,6 +271,7 @@  discard block
 block discarded – undo
269 271
 
270 272
 	/**
271 273
 	 * @param string the height of the control
274
+	 * @param string $value
272 275
 	 */
273 276
 	public function setHeight($value)
274 277
 	{
@@ -390,6 +393,7 @@  discard block
 block discarded – undo
390 393
 
391 394
 	/**
392 395
 	 * @param string the width of the control
396
+	 * @param string $value
393 397
 	 */
394 398
 	public function setWidth($value)
395 399
 	{
Please login to merge, or discard this patch.
Spacing   +44 added lines, -44 removed lines patch added patch discarded remove patch
@@ -42,7 +42,7 @@  discard block
 block discarded – undo
42 42
 	/**
43 43
 	 *	@var boolean ensures the inclusion the id in the tag rendering.
44 44
 	 */
45
-	private $_ensureid=false;
45
+	private $_ensureid = false;
46 46
 
47 47
 	/**
48 48
 	 *	@var TWebControlDecorator this render things before and after both the open and close tag
@@ -72,9 +72,9 @@  discard block
 block discarded – undo
72 72
 	/**
73 73
 	 * @return TWebControlDecorator
74 74
 	 */
75
-	public function getDecorator($create=true)
75
+	public function getDecorator($create = true)
76 76
 	{
77
-		if($create && !$this->_decorator)
77
+		if ($create && !$this->_decorator)
78 78
 			$this->_decorator = Prado::createComponent('TWebControlDecorator', $this);
79 79
 		return $this->_decorator;
80 80
 	}
@@ -90,9 +90,9 @@  discard block
 block discarded – undo
90 90
 		$this->setAccessKey($control->getAccessKey());
91 91
 		$this->setToolTip($control->getToolTip());
92 92
 		$this->setTabIndex($control->getTabIndex());
93
-		if(!$control->getEnabled())
93
+		if (!$control->getEnabled())
94 94
 			$this->setEnabled(false);
95
-		if($control->getHasAttributes())
95
+		if ($control->getHasAttributes())
96 96
 			$this->getAttributes()->copyFrom($control->getAttributes());
97 97
 	}
98 98
 
@@ -101,7 +101,7 @@  discard block
 block discarded – undo
101 101
 	 */
102 102
 	public function getAccessKey()
103 103
 	{
104
-		return $this->getViewState('AccessKey','');
104
+		return $this->getViewState('AccessKey', '');
105 105
 	}
106 106
 
107 107
 	/**
@@ -113,9 +113,9 @@  discard block
 block discarded – undo
113 113
 	 */
114 114
 	public function setAccessKey($value)
115 115
 	{
116
-		if(strlen($value)>1)
117
-			throw new TInvalidDataValueException('webcontrol_accesskey_invalid',get_class($this),$value);
118
-		$this->setViewState('AccessKey',$value,'');
116
+		if (strlen($value) > 1)
117
+			throw new TInvalidDataValueException('webcontrol_accesskey_invalid', get_class($this), $value);
118
+		$this->setViewState('AccessKey', $value, '');
119 119
 	}
120 120
 
121 121
 	/**
@@ -123,7 +123,7 @@  discard block
 block discarded – undo
123 123
 	 */
124 124
 	public function getBackColor()
125 125
 	{
126
-		if($style=$this->getViewState('Style',null))
126
+		if ($style = $this->getViewState('Style', null))
127 127
 			return $style->getBackColor();
128 128
 		else
129 129
 			return '';
@@ -142,7 +142,7 @@  discard block
 block discarded – undo
142 142
 	 */
143 143
 	public function getBorderColor()
144 144
 	{
145
-		if($style=$this->getViewState('Style',null))
145
+		if ($style = $this->getViewState('Style', null))
146 146
 			return $style->getBorderColor();
147 147
 		else
148 148
 			return '';
@@ -161,7 +161,7 @@  discard block
 block discarded – undo
161 161
 	 */
162 162
 	public function getBorderStyle()
163 163
 	{
164
-		if($style=$this->getViewState('Style',null))
164
+		if ($style = $this->getViewState('Style', null))
165 165
 			return $style->getBorderStyle();
166 166
 		else
167 167
 			return '';
@@ -180,7 +180,7 @@  discard block
 block discarded – undo
180 180
 	 */
181 181
 	public function getBorderWidth()
182 182
 	{
183
-		if($style=$this->getViewState('Style',null))
183
+		if ($style = $this->getViewState('Style', null))
184 184
 			return $style->getBorderWidth();
185 185
 		else
186 186
 			return '';
@@ -207,7 +207,7 @@  discard block
 block discarded – undo
207 207
 	 */
208 208
 	public function getForeColor()
209 209
 	{
210
-		if($style=$this->getViewState('Style',null))
210
+		if ($style = $this->getViewState('Style', null))
211 211
 			return $style->getForeColor();
212 212
 		else
213 213
 			return '';
@@ -226,7 +226,7 @@  discard block
 block discarded – undo
226 226
 	 */
227 227
 	public function getHeight()
228 228
 	{
229
-		if($style=$this->getViewState('Style',null))
229
+		if ($style = $this->getViewState('Style', null))
230 230
 			return $style->getHeight();
231 231
 		else
232 232
 			return '';
@@ -261,7 +261,7 @@  discard block
 block discarded – undo
261 261
 	 */
262 262
 	public function getCssClass()
263 263
 	{
264
-		if($style=$this->getViewState('Style',null))
264
+		if ($style = $this->getViewState('Style', null))
265 265
 			return $style->getCssClass();
266 266
 		else
267 267
 			return '';
@@ -280,7 +280,7 @@  discard block
 block discarded – undo
280 280
 	 */
281 281
 	public function getHasStyle()
282 282
 	{
283
-		return $this->getViewState('Style',null)!==null;
283
+		return $this->getViewState('Style', null) !== null;
284 284
 	}
285 285
 
286 286
 	/**
@@ -298,12 +298,12 @@  discard block
 block discarded – undo
298 298
 	 */
299 299
 	public function getStyle()
300 300
 	{
301
-		if($style=$this->getViewState('Style',null))
301
+		if ($style = $this->getViewState('Style', null))
302 302
 			return $style;
303 303
 		else
304 304
 		{
305
-			$style=$this->createStyle();
306
-			$this->setViewState('Style',$style,null);
305
+			$style = $this->createStyle();
306
+			$this->setViewState('Style', $style, null);
307 307
 			return $style;
308 308
 		}
309 309
 	}
@@ -316,10 +316,10 @@  discard block
 block discarded – undo
316 316
 	 */
317 317
 	public function setStyle($value)
318 318
 	{
319
-		if(is_string($value))
319
+		if (is_string($value))
320 320
 			$this->getStyle()->setCustomStyle($value);
321 321
 		else
322
-			throw new TInvalidDataValueException('webcontrol_style_invalid',get_class($this));
322
+			throw new TInvalidDataValueException('webcontrol_style_invalid', get_class($this));
323 323
 	}
324 324
 
325 325
 	/**
@@ -335,7 +335,7 @@  discard block
 block discarded – undo
335 335
 	 */
336 336
 	public function getTabIndex()
337 337
 	{
338
-		return $this->getViewState('TabIndex',0);
338
+		return $this->getViewState('TabIndex', 0);
339 339
 	}
340 340
 
341 341
 	/**
@@ -345,7 +345,7 @@  discard block
 block discarded – undo
345 345
 	 */
346 346
 	public function setTabIndex($value)
347 347
 	{
348
-		$this->setViewState('TabIndex',TPropertyValue::ensureInteger($value),0);
348
+		$this->setViewState('TabIndex', TPropertyValue::ensureInteger($value), 0);
349 349
 	}
350 350
 
351 351
 	/**
@@ -364,7 +364,7 @@  discard block
 block discarded – undo
364 364
 	 */
365 365
 	public function getToolTip()
366 366
 	{
367
-		return $this->getViewState('ToolTip','');
367
+		return $this->getViewState('ToolTip', '');
368 368
 	}
369 369
 
370 370
 	/**
@@ -374,7 +374,7 @@  discard block
 block discarded – undo
374 374
 	 */
375 375
 	public function setToolTip($value)
376 376
 	{
377
-		$this->setViewState('ToolTip',$value,'');
377
+		$this->setViewState('ToolTip', $value, '');
378 378
 	}
379 379
 
380 380
 	/**
@@ -382,7 +382,7 @@  discard block
 block discarded – undo
382 382
 	 */
383 383
 	public function getWidth()
384 384
 	{
385
-		if($style=$this->getViewState('Style',null))
385
+		if ($style = $this->getViewState('Style', null))
386 386
 			return $style->getWidth();
387 387
 		else
388 388
 			return '';
@@ -404,7 +404,7 @@  discard block
 block discarded – undo
404 404
 	 * @param TEventParameter event parameter to be passed to the event handlers
405 405
 	 */
406 406
 	public function onPreRender($param) {
407
-		if($decorator = $this->getDecorator(false))
407
+		if ($decorator = $this->getDecorator(false))
408 408
 			$decorator->instantiate();
409 409
 
410 410
 		parent::onPreRender($param);
@@ -419,22 +419,22 @@  discard block
 block discarded – undo
419 419
 	 */
420 420
 	protected function addAttributesToRender($writer)
421 421
 	{
422
-		if($this->getID()!=='' || $this->getEnsureId())
423
-			$writer->addAttribute('id',$this->getClientID());
424
-		if(($accessKey=$this->getAccessKey())!=='')
425
-			$writer->addAttribute('accesskey',$accessKey);
426
-		if(!$this->getEnabled())
427
-			$writer->addAttribute('disabled','disabled');
428
-		if(($tabIndex=$this->getTabIndex())>0)
429
-			$writer->addAttribute('tabindex',"$tabIndex");
430
-		if(($toolTip=$this->getToolTip())!=='')
431
-			$writer->addAttribute('title',$toolTip);
432
-		if($style=$this->getViewState('Style',null))
422
+		if ($this->getID() !== '' || $this->getEnsureId())
423
+			$writer->addAttribute('id', $this->getClientID());
424
+		if (($accessKey = $this->getAccessKey()) !== '')
425
+			$writer->addAttribute('accesskey', $accessKey);
426
+		if (!$this->getEnabled())
427
+			$writer->addAttribute('disabled', 'disabled');
428
+		if (($tabIndex = $this->getTabIndex()) > 0)
429
+			$writer->addAttribute('tabindex', "$tabIndex");
430
+		if (($toolTip = $this->getToolTip()) !== '')
431
+			$writer->addAttribute('title', $toolTip);
432
+		if ($style = $this->getViewState('Style', null))
433 433
 			$style->addAttributesToRender($writer);
434
-		if($this->getHasAttributes())
434
+		if ($this->getHasAttributes())
435 435
 		{
436
-			foreach($this->getAttributes() as $name=>$value)
437
-				$writer->addAttribute($name,$value);
436
+			foreach ($this->getAttributes() as $name=>$value)
437
+				$writer->addAttribute($name, $value);
438 438
 		}
439 439
 	}
440 440
 
@@ -460,7 +460,7 @@  discard block
 block discarded – undo
460 460
 	 */
461 461
 	public function renderBeginTag($writer)
462 462
 	{
463
-		if($decorator = $this->getDecorator(false)) {
463
+		if ($decorator = $this->getDecorator(false)) {
464 464
 			$decorator->renderPreTagText($writer);
465 465
 			$this->addAttributesToRender($writer);
466 466
 			$writer->renderBeginTag($this->getTagName());
@@ -488,7 +488,7 @@  discard block
 block discarded – undo
488 488
 	 */
489 489
 	public function renderEndTag($writer)
490 490
 	{
491
-		if($decorator = $this->getDecorator(false)) {
491
+		if ($decorator = $this->getDecorator(false)) {
492 492
 			$decorator->renderPostContentsText($writer);
493 493
 			$writer->renderEndTag();
494 494
 			$decorator->renderPostTagText($writer);
Please login to merge, or discard this patch.
Braces   +87 added lines, -65 removed lines patch added patch discarded remove patch
@@ -74,8 +74,9 @@  discard block
 block discarded – undo
74 74
 	 */
75 75
 	public function getDecorator($create=true)
76 76
 	{
77
-		if($create && !$this->_decorator)
78
-			$this->_decorator = Prado::createComponent('TWebControlDecorator', $this);
77
+		if($create && !$this->_decorator) {
78
+					$this->_decorator = Prado::createComponent('TWebControlDecorator', $this);
79
+		}
79 80
 		return $this->_decorator;
80 81
 	}
81 82
 
@@ -90,10 +91,12 @@  discard block
 block discarded – undo
90 91
 		$this->setAccessKey($control->getAccessKey());
91 92
 		$this->setToolTip($control->getToolTip());
92 93
 		$this->setTabIndex($control->getTabIndex());
93
-		if(!$control->getEnabled())
94
-			$this->setEnabled(false);
95
-		if($control->getHasAttributes())
96
-			$this->getAttributes()->copyFrom($control->getAttributes());
94
+		if(!$control->getEnabled()) {
95
+					$this->setEnabled(false);
96
+		}
97
+		if($control->getHasAttributes()) {
98
+					$this->getAttributes()->copyFrom($control->getAttributes());
99
+		}
97 100
 	}
98 101
 
99 102
 	/**
@@ -113,8 +116,9 @@  discard block
 block discarded – undo
113 116
 	 */
114 117
 	public function setAccessKey($value)
115 118
 	{
116
-		if(strlen($value)>1)
117
-			throw new TInvalidDataValueException('webcontrol_accesskey_invalid',get_class($this),$value);
119
+		if(strlen($value)>1) {
120
+					throw new TInvalidDataValueException('webcontrol_accesskey_invalid',get_class($this),$value);
121
+		}
118 122
 		$this->setViewState('AccessKey',$value,'');
119 123
 	}
120 124
 
@@ -123,10 +127,11 @@  discard block
 block discarded – undo
123 127
 	 */
124 128
 	public function getBackColor()
125 129
 	{
126
-		if($style=$this->getViewState('Style',null))
127
-			return $style->getBackColor();
128
-		else
129
-			return '';
130
+		if($style=$this->getViewState('Style',null)) {
131
+					return $style->getBackColor();
132
+		} else {
133
+					return '';
134
+		}
130 135
 	}
131 136
 
132 137
 	/**
@@ -142,10 +147,11 @@  discard block
 block discarded – undo
142 147
 	 */
143 148
 	public function getBorderColor()
144 149
 	{
145
-		if($style=$this->getViewState('Style',null))
146
-			return $style->getBorderColor();
147
-		else
148
-			return '';
150
+		if($style=$this->getViewState('Style',null)) {
151
+					return $style->getBorderColor();
152
+		} else {
153
+					return '';
154
+		}
149 155
 	}
150 156
 
151 157
 	/**
@@ -161,10 +167,11 @@  discard block
 block discarded – undo
161 167
 	 */
162 168
 	public function getBorderStyle()
163 169
 	{
164
-		if($style=$this->getViewState('Style',null))
165
-			return $style->getBorderStyle();
166
-		else
167
-			return '';
170
+		if($style=$this->getViewState('Style',null)) {
171
+					return $style->getBorderStyle();
172
+		} else {
173
+					return '';
174
+		}
168 175
 	}
169 176
 
170 177
 	/**
@@ -180,10 +187,11 @@  discard block
 block discarded – undo
180 187
 	 */
181 188
 	public function getBorderWidth()
182 189
 	{
183
-		if($style=$this->getViewState('Style',null))
184
-			return $style->getBorderWidth();
185
-		else
186
-			return '';
190
+		if($style=$this->getViewState('Style',null)) {
191
+					return $style->getBorderWidth();
192
+		} else {
193
+					return '';
194
+		}
187 195
 	}
188 196
 
189 197
 	/**
@@ -207,10 +215,11 @@  discard block
 block discarded – undo
207 215
 	 */
208 216
 	public function getForeColor()
209 217
 	{
210
-		if($style=$this->getViewState('Style',null))
211
-			return $style->getForeColor();
212
-		else
213
-			return '';
218
+		if($style=$this->getViewState('Style',null)) {
219
+					return $style->getForeColor();
220
+		} else {
221
+					return '';
222
+		}
214 223
 	}
215 224
 
216 225
 	/**
@@ -226,10 +235,11 @@  discard block
 block discarded – undo
226 235
 	 */
227 236
 	public function getHeight()
228 237
 	{
229
-		if($style=$this->getViewState('Style',null))
230
-			return $style->getHeight();
231
-		else
232
-			return '';
238
+		if($style=$this->getViewState('Style',null)) {
239
+					return $style->getHeight();
240
+		} else {
241
+					return '';
242
+		}
233 243
 	}
234 244
 
235 245
 	/**
@@ -261,10 +271,11 @@  discard block
 block discarded – undo
261 271
 	 */
262 272
 	public function getCssClass()
263 273
 	{
264
-		if($style=$this->getViewState('Style',null))
265
-			return $style->getCssClass();
266
-		else
267
-			return '';
274
+		if($style=$this->getViewState('Style',null)) {
275
+					return $style->getCssClass();
276
+		} else {
277
+					return '';
278
+		}
268 279
 	}
269 280
 
270 281
 	/**
@@ -298,9 +309,9 @@  discard block
 block discarded – undo
298 309
 	 */
299 310
 	public function getStyle()
300 311
 	{
301
-		if($style=$this->getViewState('Style',null))
302
-			return $style;
303
-		else
312
+		if($style=$this->getViewState('Style',null)) {
313
+					return $style;
314
+		} else
304 315
 		{
305 316
 			$style=$this->createStyle();
306 317
 			$this->setViewState('Style',$style,null);
@@ -316,10 +327,11 @@  discard block
 block discarded – undo
316 327
 	 */
317 328
 	public function setStyle($value)
318 329
 	{
319
-		if(is_string($value))
320
-			$this->getStyle()->setCustomStyle($value);
321
-		else
322
-			throw new TInvalidDataValueException('webcontrol_style_invalid',get_class($this));
330
+		if(is_string($value)) {
331
+					$this->getStyle()->setCustomStyle($value);
332
+		} else {
333
+					throw new TInvalidDataValueException('webcontrol_style_invalid',get_class($this));
334
+		}
323 335
 	}
324 336
 
325 337
 	/**
@@ -382,10 +394,11 @@  discard block
 block discarded – undo
382 394
 	 */
383 395
 	public function getWidth()
384 396
 	{
385
-		if($style=$this->getViewState('Style',null))
386
-			return $style->getWidth();
387
-		else
388
-			return '';
397
+		if($style=$this->getViewState('Style',null)) {
398
+					return $style->getWidth();
399
+		} else {
400
+					return '';
401
+		}
389 402
 	}
390 403
 
391 404
 	/**
@@ -404,8 +417,9 @@  discard block
 block discarded – undo
404 417
 	 * @param TEventParameter event parameter to be passed to the event handlers
405 418
 	 */
406 419
 	public function onPreRender($param) {
407
-		if($decorator = $this->getDecorator(false))
408
-			$decorator->instantiate();
420
+		if($decorator = $this->getDecorator(false)) {
421
+					$decorator->instantiate();
422
+		}
409 423
 
410 424
 		parent::onPreRender($param);
411 425
 	}
@@ -419,22 +433,29 @@  discard block
 block discarded – undo
419 433
 	 */
420 434
 	protected function addAttributesToRender($writer)
421 435
 	{
422
-		if($this->getID()!=='' || $this->getEnsureId())
423
-			$writer->addAttribute('id',$this->getClientID());
424
-		if(($accessKey=$this->getAccessKey())!=='')
425
-			$writer->addAttribute('accesskey',$accessKey);
426
-		if(!$this->getEnabled())
427
-			$writer->addAttribute('disabled','disabled');
428
-		if(($tabIndex=$this->getTabIndex())>0)
429
-			$writer->addAttribute('tabindex',"$tabIndex");
430
-		if(($toolTip=$this->getToolTip())!=='')
431
-			$writer->addAttribute('title',$toolTip);
432
-		if($style=$this->getViewState('Style',null))
433
-			$style->addAttributesToRender($writer);
436
+		if($this->getID()!=='' || $this->getEnsureId()) {
437
+					$writer->addAttribute('id',$this->getClientID());
438
+		}
439
+		if(($accessKey=$this->getAccessKey())!=='') {
440
+					$writer->addAttribute('accesskey',$accessKey);
441
+		}
442
+		if(!$this->getEnabled()) {
443
+					$writer->addAttribute('disabled','disabled');
444
+		}
445
+		if(($tabIndex=$this->getTabIndex())>0) {
446
+					$writer->addAttribute('tabindex',"$tabIndex");
447
+		}
448
+		if(($toolTip=$this->getToolTip())!=='') {
449
+					$writer->addAttribute('title',$toolTip);
450
+		}
451
+		if($style=$this->getViewState('Style',null)) {
452
+					$style->addAttributesToRender($writer);
453
+		}
434 454
 		if($this->getHasAttributes())
435 455
 		{
436
-			foreach($this->getAttributes() as $name=>$value)
437
-				$writer->addAttribute($name,$value);
456
+			foreach($this->getAttributes() as $name=>$value) {
457
+							$writer->addAttribute($name,$value);
458
+			}
438 459
 		}
439 460
 	}
440 461
 
@@ -492,7 +513,8 @@  discard block
 block discarded – undo
492 513
 			$decorator->renderPostContentsText($writer);
493 514
 			$writer->renderEndTag();
494 515
 			$decorator->renderPostTagText($writer);
495
-		} else
496
-			$writer->renderEndTag($writer);
516
+		} else {
517
+					$writer->renderEndTag($writer);
518
+		}
497 519
 	}
498 520
 }
Please login to merge, or discard this patch.
framework/Web/UI/WebControls/TWizard.php 3 patches
Doc Comments   +13 added lines patch added patch discarded remove patch
@@ -664,6 +664,7 @@  discard block
 block discarded – undo
664 664
 	 * This event is raised when a cancel navigation button is clicked in the
665 665
 	 * current active step.
666 666
 	 * @param TEventParameter event parameter
667
+	 * @param TCommandEventParameter $param
667 668
 	 */
668 669
 	public function onCancelButtonClick($param)
669 670
 	{
@@ -677,6 +678,7 @@  discard block
 block discarded – undo
677 678
 	 * This event is raised when a finish navigation button is clicked in the
678 679
 	 * current active step.
679 680
 	 * @param TWizardNavigationEventParameter event parameter
681
+	 * @param TWizardNavigationEventParameter $param
680 682
 	 */
681 683
 	public function onCompleteButtonClick($param)
682 684
 	{
@@ -690,6 +692,7 @@  discard block
 block discarded – undo
690 692
 	 * This event is raised when a next navigation button is clicked in the
691 693
 	 * current active step.
692 694
 	 * @param TWizardNavigationEventParameter event parameter
695
+	 * @param TWizardNavigationEventParameter $param
693 696
 	 */
694 697
 	public function onNextButtonClick($param)
695 698
 	{
@@ -701,6 +704,7 @@  discard block
 block discarded – undo
701 704
 	 * This event is raised when a previous navigation button is clicked in the
702 705
 	 * current active step.
703 706
 	 * @param TWizardNavigationEventParameter event parameter
707
+	 * @param TWizardNavigationEventParameter $param
704 708
 	 */
705 709
 	public function onPreviousButtonClick($param)
706 710
 	{
@@ -711,6 +715,7 @@  discard block
 block discarded – undo
711 715
 	 * Raises <b>OnSideBarButtonClick</b> event.
712 716
 	 * This event is raised when a link button in the side bar is clicked.
713 717
 	 * @param TWizardNavigationEventParameter event parameter
718
+	 * @param TWizardNavigationEventParameter $param
714 719
 	 */
715 720
 	public function onSideBarButtonClick($param)
716 721
 	{
@@ -739,6 +744,7 @@  discard block
 block discarded – undo
739 744
 	 * This method should only be used by control developers.
740 745
 	 * It is invoked when a step is added into the step collection of the wizard.
741 746
 	 * @param TWizardStep wizard step to be added into multiview.
747
+	 * @param TWizardStep $step
742 748
 	 */
743 749
 	public function addedWizardStep($step)
744 750
 	{
@@ -1282,6 +1288,7 @@  discard block
 block discarded – undo
1282 1288
 	 * Determines the index of the previous step based on history.
1283 1289
 	 * @param boolean whether the first item in the history stack should be popped
1284 1290
 	 * up after calling this method.
1291
+	 * @param boolean $popStack
1285 1292
 	 */
1286 1293
 	protected function getPreviousStepIndex($popStack)
1287 1294
 	{
@@ -1325,6 +1332,7 @@  discard block
 block discarded – undo
1325 1332
 
1326 1333
 	/**
1327 1334
 	 * @param integer index of the step
1335
+	 * @param integer $index
1328 1336
 	 * @return boolean whether navigation to the specified step is allowed
1329 1337
 	 */
1330 1338
 	protected function allowNavigationToStep($index)
@@ -1837,6 +1845,7 @@  discard block
 block discarded – undo
1837 1845
 	/**
1838 1846
 	 * Constructor.
1839 1847
 	 * @param integer current step index
1848
+	 * @param integer $currentStep
1840 1849
 	 */
1841 1850
 	public function __construct($currentStep)
1842 1851
 	{
@@ -1878,6 +1887,7 @@  discard block
 block discarded – undo
1878 1887
 
1879 1888
 	/**
1880 1889
 	 * @param boolean whether navigation to the next step should be canceled.
1890
+	 * @param boolean $value
1881 1891
 	 */
1882 1892
 	public function setCancelNavigation($value)
1883 1893
 	{
@@ -1945,6 +1955,7 @@  discard block
 block discarded – undo
1945 1955
 	/**
1946 1956
 	 * Constructor.
1947 1957
 	 * @param TWizard the wizard owning this template
1958
+	 * @param TWizard $wizard
1948 1959
 	 */
1949 1960
 	public function __construct($wizard)
1950 1961
 	{
@@ -1975,6 +1986,8 @@  discard block
 block discarded – undo
1975 1986
 	 * @param TWizardNavigationButtonStyle button style
1976 1987
 	 * @param boolean whether the button should cause validation
1977 1988
 	 * @param string command name for the button's OnCommand event
1989
+	 * @param TWizardNavigationButtonStyle $buttonStyle
1990
+	 * @param boolean $causesValidation
1978 1991
 	 * @throws TInvalidDataValueException if the button type is not recognized
1979 1992
 	 */
1980 1993
 	protected function createNavigationButton($buttonStyle,$causesValidation,$commandName)
Please login to merge, or discard this patch.
Spacing   +348 added lines, -348 removed lines patch added patch discarded remove patch
@@ -85,56 +85,56 @@  discard block
 block discarded – undo
85 85
 	 * Wizard step types.
86 86
 	 * @deprecated deprecated since version 3.0.4 (use TWizardStepType constants instead)
87 87
 	 */
88
-	const ST_AUTO='Auto';
89
-	const ST_START='Start';
90
-	const ST_STEP='Step';
91
-	const ST_FINISH='Finish';
92
-	const ST_COMPLETE='Complete';
88
+	const ST_AUTO = 'Auto';
89
+	const ST_START = 'Start';
90
+	const ST_STEP = 'Step';
91
+	const ST_FINISH = 'Finish';
92
+	const ST_COMPLETE = 'Complete';
93 93
 	/**
94 94
 	 * Navigation commands.
95 95
 	 */
96
-	const CMD_PREVIOUS='PreviousStep';
97
-	const CMD_NEXT='NextStep';
98
-	const CMD_CANCEL='Cancel';
99
-	const CMD_COMPLETE='Complete';
100
-	const CMD_MOVETO='MoveTo';
96
+	const CMD_PREVIOUS = 'PreviousStep';
97
+	const CMD_NEXT = 'NextStep';
98
+	const CMD_CANCEL = 'Cancel';
99
+	const CMD_COMPLETE = 'Complete';
100
+	const CMD_MOVETO = 'MoveTo';
101 101
 	/**
102 102
 	 * Side bar button ID
103 103
 	 */
104
-	const ID_SIDEBAR_BUTTON='SideBarButton';
104
+	const ID_SIDEBAR_BUTTON = 'SideBarButton';
105 105
 	/**
106 106
 	 * Side bar data list
107 107
 	 */
108
-	const ID_SIDEBAR_LIST='SideBarList';
108
+	const ID_SIDEBAR_LIST = 'SideBarList';
109 109
 
110 110
 	/**
111 111
 	 * @var TMultiView multiview that contains the wizard steps
112 112
 	 */
113
-	private $_multiView=null;
113
+	private $_multiView = null;
114 114
 	/**
115 115
 	 * @var mixed navigation template for the start step.
116 116
 	 */
117
-	private $_startNavigationTemplate=null;
117
+	private $_startNavigationTemplate = null;
118 118
 	/**
119 119
 	 * @var mixed navigation template for internal steps.
120 120
 	 */
121
-	private $_stepNavigationTemplate=null;
121
+	private $_stepNavigationTemplate = null;
122 122
 	/**
123 123
 	 * @var mixed navigation template for the finish step.
124 124
 	 */
125
-	private $_finishNavigationTemplate=null;
125
+	private $_finishNavigationTemplate = null;
126 126
 	/**
127 127
 	 * @var mixed template for wizard header.
128 128
 	 */
129
-	private $_headerTemplate=null;
129
+	private $_headerTemplate = null;
130 130
 	/**
131 131
 	 * @var mixed template for the side bar.
132 132
 	 */
133
-	private $_sideBarTemplate=null;
133
+	private $_sideBarTemplate = null;
134 134
 	/**
135 135
 	 * @var TWizardStepCollection
136 136
 	 */
137
-	private $_wizardSteps=null;
137
+	private $_wizardSteps = null;
138 138
 	/**
139 139
 	 * @var TPanel container of the wizard header
140 140
 	 */
@@ -166,7 +166,7 @@  discard block
 block discarded – undo
166 166
 	/**
167 167
 	 * @var boolean whether ActiveStepIndex was already set
168 168
 	 */
169
-	private $_activeStepIndexSet=false;
169
+	private $_activeStepIndexSet = false;
170 170
 	/**
171 171
 	 * @var TDataList side bar data list.
172 172
 	 */
@@ -174,7 +174,7 @@  discard block
 block discarded – undo
174 174
 	/**
175 175
 	 * @var boolean whether navigation should be cancelled (a status set in OnSideBarButtonClick)
176 176
 	 */
177
-	private $_cancelNavigation=false;
177
+	private $_cancelNavigation = false;
178 178
 
179 179
 	/**
180 180
 	 * @return string tag name for the wizard
@@ -192,7 +192,7 @@  discard block
 block discarded – undo
192 192
 	 */
193 193
 	public function addParsedObject($object)
194 194
 	{
195
-		if($object instanceof TWizardStep)
195
+		if ($object instanceof TWizardStep)
196 196
 			$this->getWizardSteps()->add($object);
197 197
 	}
198 198
 
@@ -210,7 +210,7 @@  discard block
 block discarded – undo
210 210
 	 */
211 211
 	public function setActiveStep($step)
212 212
 	{
213
-		if(($index=$this->getWizardSteps()->indexOf($step))<0)
213
+		if (($index = $this->getWizardSteps()->indexOf($step)) < 0)
214 214
 			throw new TInvalidOperationException('wizard_step_invalid');
215 215
 		$this->setActiveStepIndex($index);
216 216
 	}
@@ -228,13 +228,13 @@  discard block
 block discarded – undo
228 228
 	 */
229 229
 	public function setActiveStepIndex($value)
230 230
 	{
231
-		$value=TPropertyValue::ensureInteger($value);
232
-		$multiView=$this->getMultiView();
233
-		if($multiView->getActiveViewIndex()!==$value)
231
+		$value = TPropertyValue::ensureInteger($value);
232
+		$multiView = $this->getMultiView();
233
+		if ($multiView->getActiveViewIndex() !== $value)
234 234
 		{
235 235
 			$multiView->setActiveViewIndex($value);
236
-			$this->_activeStepIndexSet=true;
237
-			if($this->_sideBarDataList!==null && $this->getSideBarTemplate()!==null)
236
+			$this->_activeStepIndexSet = true;
237
+			if ($this->_sideBarDataList !== null && $this->getSideBarTemplate() !== null)
238 238
 			{
239 239
 				$this->_sideBarDataList->setSelectedItemIndex($this->getActiveStepIndex());
240 240
 				$this->_sideBarDataList->dataBind();
@@ -247,8 +247,8 @@  discard block
 block discarded – undo
247 247
 	 */
248 248
 	public function getWizardSteps()
249 249
 	{
250
-		if($this->_wizardSteps===null)
251
-			$this->_wizardSteps=new TWizardStepCollection($this);
250
+		if ($this->_wizardSteps === null)
251
+			$this->_wizardSteps = new TWizardStepCollection($this);
252 252
 		return $this->_wizardSteps;
253 253
 	}
254 254
 
@@ -257,7 +257,7 @@  discard block
 block discarded – undo
257 257
 	 */
258 258
 	public function getShowCancelButton()
259 259
 	{
260
-		return $this->getViewState('ShowCancelButton',false);
260
+		return $this->getViewState('ShowCancelButton', false);
261 261
 	}
262 262
 
263 263
 	/**
@@ -265,7 +265,7 @@  discard block
 block discarded – undo
265 265
 	 */
266 266
 	public function setShowCancelButton($value)
267 267
 	{
268
-		$this->setViewState('ShowCancelButton',TPropertyValue::ensureBoolean($value),false);
268
+		$this->setViewState('ShowCancelButton', TPropertyValue::ensureBoolean($value), false);
269 269
 	}
270 270
 
271 271
 	/**
@@ -273,7 +273,7 @@  discard block
 block discarded – undo
273 273
 	 */
274 274
 	public function getShowSideBar()
275 275
 	{
276
-		return $this->getViewState('ShowSideBar',true);
276
+		return $this->getViewState('ShowSideBar', true);
277 277
 	}
278 278
 
279 279
 	/**
@@ -281,7 +281,7 @@  discard block
 block discarded – undo
281 281
 	 */
282 282
 	public function setShowSideBar($value)
283 283
 	{
284
-		$this->setViewState('ShowSideBar',TPropertyValue::ensureBoolean($value),true);
284
+		$this->setViewState('ShowSideBar', TPropertyValue::ensureBoolean($value), true);
285 285
 	}
286 286
 
287 287
 	/**
@@ -297,7 +297,7 @@  discard block
 block discarded – undo
297 297
 	 */
298 298
 	public function setStartNavigationTemplate($value)
299 299
 	{
300
-		$this->_startNavigationTemplate=$value;
300
+		$this->_startNavigationTemplate = $value;
301 301
 		$this->requiresControlsRecreation();
302 302
 	}
303 303
 
@@ -314,7 +314,7 @@  discard block
 block discarded – undo
314 314
 	 */
315 315
 	public function setStepNavigationTemplate($value)
316 316
 	{
317
-		$this->_stepNavigationTemplate=$value;
317
+		$this->_stepNavigationTemplate = $value;
318 318
 		$this->requiresControlsRecreation();
319 319
 	}
320 320
 
@@ -331,7 +331,7 @@  discard block
 block discarded – undo
331 331
 	 */
332 332
 	public function setFinishNavigationTemplate($value)
333 333
 	{
334
-		$this->_finishNavigationTemplate=$value;
334
+		$this->_finishNavigationTemplate = $value;
335 335
 		$this->requiresControlsRecreation();
336 336
 	}
337 337
 
@@ -348,7 +348,7 @@  discard block
 block discarded – undo
348 348
 	 */
349 349
 	public function setHeaderTemplate($value)
350 350
 	{
351
-		$this->_headerTemplate=$value;
351
+		$this->_headerTemplate = $value;
352 352
 		$this->requiresControlsRecreation();
353 353
 	}
354 354
 
@@ -365,7 +365,7 @@  discard block
 block discarded – undo
365 365
 	 */
366 366
 	public function setSideBarTemplate($value)
367 367
 	{
368
-		$this->_sideBarTemplate=$value;
368
+		$this->_sideBarTemplate = $value;
369 369
 		$this->requiresControlsRecreation();
370 370
 	}
371 371
 
@@ -374,7 +374,7 @@  discard block
 block discarded – undo
374 374
 	 */
375 375
 	public function getHeaderText()
376 376
 	{
377
-		return $this->getViewState('HeaderText','');
377
+		return $this->getViewState('HeaderText', '');
378 378
 	}
379 379
 
380 380
 	/**
@@ -382,7 +382,7 @@  discard block
 block discarded – undo
382 382
 	 */
383 383
 	public function setHeaderText($value)
384 384
 	{
385
-		$this->setViewState('HeaderText',TPropertyValue::ensureString($value),'');
385
+		$this->setViewState('HeaderText', TPropertyValue::ensureString($value), '');
386 386
 	}
387 387
 
388 388
 	/**
@@ -391,7 +391,7 @@  discard block
 block discarded – undo
391 391
 	 */
392 392
 	public function getCancelDestinationUrl()
393 393
 	{
394
-		return $this->getViewState('CancelDestinationUrl','');
394
+		return $this->getViewState('CancelDestinationUrl', '');
395 395
 	}
396 396
 
397 397
 	/**
@@ -400,7 +400,7 @@  discard block
 block discarded – undo
400 400
 	 */
401 401
 	public function setCancelDestinationUrl($value)
402 402
 	{
403
-		$this->setViewState('CancelDestinationUrl',TPropertyValue::ensureString($value),'');
403
+		$this->setViewState('CancelDestinationUrl', TPropertyValue::ensureString($value), '');
404 404
 	}
405 405
 
406 406
 	/**
@@ -409,7 +409,7 @@  discard block
 block discarded – undo
409 409
 	 */
410 410
 	public function getFinishDestinationUrl()
411 411
 	{
412
-		return $this->getViewState('FinishDestinationUrl','');
412
+		return $this->getViewState('FinishDestinationUrl', '');
413 413
 	}
414 414
 
415 415
 	/**
@@ -417,7 +417,7 @@  discard block
 block discarded – undo
417 417
 	 */
418 418
 	public function setFinishDestinationUrl($value)
419 419
 	{
420
-		$this->setViewState('FinishDestinationUrl',TPropertyValue::ensureString($value),'');
420
+		$this->setViewState('FinishDestinationUrl', TPropertyValue::ensureString($value), '');
421 421
 	}
422 422
 
423 423
 	/**
@@ -425,10 +425,10 @@  discard block
 block discarded – undo
425 425
 	 */
426 426
 	public function getSideBarButtonStyle()
427 427
 	{
428
-		if(($style=$this->getViewState('SideBarButtonStyle',null))===null)
428
+		if (($style = $this->getViewState('SideBarButtonStyle', null)) === null)
429 429
 		{
430
-			$style=new TStyle;
431
-			$this->setViewState('SideBarButtonStyle',$style,null);
430
+			$style = new TStyle;
431
+			$this->setViewState('SideBarButtonStyle', $style, null);
432 432
 		}
433 433
 		return $style;
434 434
 	}
@@ -438,10 +438,10 @@  discard block
 block discarded – undo
438 438
 	 */
439 439
 	public function getNavigationButtonStyle()
440 440
 	{
441
-		if(($style=$this->getViewState('NavigationButtonStyle',null))===null)
441
+		if (($style = $this->getViewState('NavigationButtonStyle', null)) === null)
442 442
 		{
443
-			$style=new TStyle;
444
-			$this->setViewState('NavigationButtonStyle',$style,null);
443
+			$style = new TStyle;
444
+			$this->setViewState('NavigationButtonStyle', $style, null);
445 445
 		}
446 446
 		return $style;
447 447
 	}
@@ -451,11 +451,11 @@  discard block
 block discarded – undo
451 451
 	 */
452 452
 	public function getStartNextButtonStyle()
453 453
 	{
454
-		if(($style=$this->getViewState('StartNextButtonStyle',null))===null)
454
+		if (($style = $this->getViewState('StartNextButtonStyle', null)) === null)
455 455
 		{
456
-			$style=new TWizardNavigationButtonStyle;
456
+			$style = new TWizardNavigationButtonStyle;
457 457
 			$style->setButtonText('Next');
458
-			$this->setViewState('StartNextButtonStyle',$style,null);
458
+			$this->setViewState('StartNextButtonStyle', $style, null);
459 459
 		}
460 460
 		return $style;
461 461
 	}
@@ -465,11 +465,11 @@  discard block
 block discarded – undo
465 465
 	 */
466 466
 	public function getStepNextButtonStyle()
467 467
 	{
468
-		if(($style=$this->getViewState('StepNextButtonStyle',null))===null)
468
+		if (($style = $this->getViewState('StepNextButtonStyle', null)) === null)
469 469
 		{
470
-			$style=new TWizardNavigationButtonStyle;
470
+			$style = new TWizardNavigationButtonStyle;
471 471
 			$style->setButtonText('Next');
472
-			$this->setViewState('StepNextButtonStyle',$style,null);
472
+			$this->setViewState('StepNextButtonStyle', $style, null);
473 473
 		}
474 474
 		return $style;
475 475
 	}
@@ -479,11 +479,11 @@  discard block
 block discarded – undo
479 479
 	 */
480 480
 	public function getStepPreviousButtonStyle()
481 481
 	{
482
-		if(($style=$this->getViewState('StepPreviousButtonStyle',null))===null)
482
+		if (($style = $this->getViewState('StepPreviousButtonStyle', null)) === null)
483 483
 		{
484
-			$style=new TWizardNavigationButtonStyle;
484
+			$style = new TWizardNavigationButtonStyle;
485 485
 			$style->setButtonText('Previous');
486
-			$this->setViewState('StepPreviousButtonStyle',$style,null);
486
+			$this->setViewState('StepPreviousButtonStyle', $style, null);
487 487
 		}
488 488
 		return $style;
489 489
 	}
@@ -493,11 +493,11 @@  discard block
 block discarded – undo
493 493
 	 */
494 494
 	public function getFinishCompleteButtonStyle()
495 495
 	{
496
-		if(($style=$this->getViewState('FinishCompleteButtonStyle',null))===null)
496
+		if (($style = $this->getViewState('FinishCompleteButtonStyle', null)) === null)
497 497
 		{
498
-			$style=new TWizardNavigationButtonStyle;
498
+			$style = new TWizardNavigationButtonStyle;
499 499
 			$style->setButtonText('Complete');
500
-			$this->setViewState('FinishCompleteButtonStyle',$style,null);
500
+			$this->setViewState('FinishCompleteButtonStyle', $style, null);
501 501
 		}
502 502
 		return $style;
503 503
 	}
@@ -507,11 +507,11 @@  discard block
 block discarded – undo
507 507
 	 */
508 508
 	public function getFinishPreviousButtonStyle()
509 509
 	{
510
-		if(($style=$this->getViewState('FinishPreviousButtonStyle',null))===null)
510
+		if (($style = $this->getViewState('FinishPreviousButtonStyle', null)) === null)
511 511
 		{
512
-			$style=new TWizardNavigationButtonStyle;
512
+			$style = new TWizardNavigationButtonStyle;
513 513
 			$style->setButtonText('Previous');
514
-			$this->setViewState('FinishPreviousButtonStyle',$style,null);
514
+			$this->setViewState('FinishPreviousButtonStyle', $style, null);
515 515
 		}
516 516
 		return $style;
517 517
 	}
@@ -521,11 +521,11 @@  discard block
 block discarded – undo
521 521
 	 */
522 522
 	public function getCancelButtonStyle()
523 523
 	{
524
-		if(($style=$this->getViewState('CancelButtonStyle',null))===null)
524
+		if (($style = $this->getViewState('CancelButtonStyle', null)) === null)
525 525
 		{
526
-			$style=new TWizardNavigationButtonStyle;
526
+			$style = new TWizardNavigationButtonStyle;
527 527
 			$style->setButtonText('Cancel');
528
-			$this->setViewState('CancelButtonStyle',$style,null);
528
+			$this->setViewState('CancelButtonStyle', $style, null);
529 529
 		}
530 530
 		return $style;
531 531
 	}
@@ -535,10 +535,10 @@  discard block
 block discarded – undo
535 535
 	 */
536 536
 	public function getSideBarStyle()
537 537
 	{
538
-		if(($style=$this->getViewState('SideBarStyle',null))===null)
538
+		if (($style = $this->getViewState('SideBarStyle', null)) === null)
539 539
 		{
540
-			$style=new TPanelStyle;
541
-			$this->setViewState('SideBarStyle',$style,null);
540
+			$style = new TPanelStyle;
541
+			$this->setViewState('SideBarStyle', $style, null);
542 542
 		}
543 543
 		return $style;
544 544
 	}
@@ -548,10 +548,10 @@  discard block
 block discarded – undo
548 548
 	 */
549 549
 	public function getHeaderStyle()
550 550
 	{
551
-		if(($style=$this->getViewState('HeaderStyle',null))===null)
551
+		if (($style = $this->getViewState('HeaderStyle', null)) === null)
552 552
 		{
553
-			$style=new TPanelStyle;
554
-			$this->setViewState('HeaderStyle',$style,null);
553
+			$style = new TPanelStyle;
554
+			$this->setViewState('HeaderStyle', $style, null);
555 555
 		}
556 556
 		return $style;
557 557
 	}
@@ -561,10 +561,10 @@  discard block
 block discarded – undo
561 561
 	 */
562 562
 	public function getStepStyle()
563 563
 	{
564
-		if(($style=$this->getViewState('StepStyle',null))===null)
564
+		if (($style = $this->getViewState('StepStyle', null)) === null)
565 565
 		{
566
-			$style=new TPanelStyle;
567
-			$this->setViewState('StepStyle',$style,null);
566
+			$style = new TPanelStyle;
567
+			$this->setViewState('StepStyle', $style, null);
568 568
 		}
569 569
 		return $style;
570 570
 	}
@@ -574,10 +574,10 @@  discard block
 block discarded – undo
574 574
 	 */
575 575
 	public function getNavigationStyle()
576 576
 	{
577
-		if(($style=$this->getViewState('NavigationStyle',null))===null)
577
+		if (($style = $this->getViewState('NavigationStyle', null)) === null)
578 578
 		{
579
-			$style=new TPanelStyle;
580
-			$this->setViewState('NavigationStyle',$style,null);
579
+			$style = new TPanelStyle;
580
+			$this->setViewState('NavigationStyle', $style, null);
581 581
 		}
582 582
 		return $style;
583 583
 	}
@@ -587,7 +587,7 @@  discard block
 block discarded – undo
587 587
 	 */
588 588
 	public function getUseDefaultLayout()
589 589
 	{
590
-		return $this->getViewState('UseDefaultLayout',true);
590
+		return $this->getViewState('UseDefaultLayout', true);
591 591
 	}
592 592
 
593 593
 	/**
@@ -597,7 +597,7 @@  discard block
 block discarded – undo
597 597
 	 */
598 598
 	public function setUseDefaultLayout($value)
599 599
 	{
600
-		$this->setViewState('UseDefaultLayout',TPropertyValue::ensureBoolean($value),true);
600
+		$this->setViewState('UseDefaultLayout', TPropertyValue::ensureBoolean($value), true);
601 601
 	}
602 602
 
603 603
 	/**
@@ -656,7 +656,7 @@  discard block
 block discarded – undo
656 656
 	 */
657 657
 	public function onActiveStepChanged($param)
658 658
 	{
659
-		$this->raiseEvent('OnActiveStepChanged',$this,$param);
659
+		$this->raiseEvent('OnActiveStepChanged', $this, $param);
660 660
 	}
661 661
 
662 662
 	/**
@@ -667,8 +667,8 @@  discard block
 block discarded – undo
667 667
 	 */
668 668
 	public function onCancelButtonClick($param)
669 669
 	{
670
-		$this->raiseEvent('OnCancelButtonClick',$this,$param);
671
-		if(($url=$this->getCancelDestinationUrl())!=='')
670
+		$this->raiseEvent('OnCancelButtonClick', $this, $param);
671
+		if (($url = $this->getCancelDestinationUrl()) !== '')
672 672
 			$this->getResponse()->redirect($url);
673 673
 	}
674 674
 
@@ -680,8 +680,8 @@  discard block
 block discarded – undo
680 680
 	 */
681 681
 	public function onCompleteButtonClick($param)
682 682
 	{
683
-		$this->raiseEvent('OnCompleteButtonClick',$this,$param);
684
-		if(($url=$this->getFinishDestinationUrl())!=='')
683
+		$this->raiseEvent('OnCompleteButtonClick', $this, $param);
684
+		if (($url = $this->getFinishDestinationUrl()) !== '')
685 685
 			$this->getResponse()->redirect($url);
686 686
 	}
687 687
 
@@ -693,7 +693,7 @@  discard block
 block discarded – undo
693 693
 	 */
694 694
 	public function onNextButtonClick($param)
695 695
 	{
696
-		$this->raiseEvent('OnNextButtonClick',$this,$param);
696
+		$this->raiseEvent('OnNextButtonClick', $this, $param);
697 697
 	}
698 698
 
699 699
 	/**
@@ -704,7 +704,7 @@  discard block
 block discarded – undo
704 704
 	 */
705 705
 	public function onPreviousButtonClick($param)
706 706
 	{
707
-		$this->raiseEvent('OnPreviousButtonClick',$this,$param);
707
+		$this->raiseEvent('OnPreviousButtonClick', $this, $param);
708 708
 	}
709 709
 
710 710
 	/**
@@ -714,7 +714,7 @@  discard block
 block discarded – undo
714 714
 	 */
715 715
 	public function onSideBarButtonClick($param)
716 716
 	{
717
-		$this->raiseEvent('OnSideBarButtonClick',$this,$param);
717
+		$this->raiseEvent('OnSideBarButtonClick', $this, $param);
718 718
 	}
719 719
 
720 720
 	/**
@@ -724,11 +724,11 @@  discard block
 block discarded – undo
724 724
 	 */
725 725
 	public function getMultiView()
726 726
 	{
727
-		if($this->_multiView===null)
727
+		if ($this->_multiView === null)
728 728
 		{
729
-			$this->_multiView=new TMultiView;
729
+			$this->_multiView = new TMultiView;
730 730
 			$this->_multiView->setID('WizardMultiView');
731
-			$this->_multiView->attachEventHandler('OnActiveViewChanged',array($this,'onActiveStepChanged'));
731
+			$this->_multiView->attachEventHandler('OnActiveViewChanged', array($this, 'onActiveStepChanged'));
732 732
 			$this->_multiView->ignoreBubbleEvents();
733 733
 		}
734 734
 		return $this->_multiView;
@@ -742,7 +742,7 @@  discard block
 block discarded – undo
742 742
 	 */
743 743
 	public function addedWizardStep($step)
744 744
 	{
745
-		if(($wizard=$step->getWizard())!==null)
745
+		if (($wizard = $step->getWizard()) !== null)
746 746
 			$wizard->getWizardSteps()->remove($step);
747 747
 		$step->setWizard($this);
748 748
 		$this->wizardStepsChanged();
@@ -770,7 +770,7 @@  discard block
 block discarded – undo
770 770
 		parent::onInit($param);
771 771
 		$this->ensureChildControls();
772 772
 		$this->setEnsureId(true);
773
-		if($this->getActiveStepIndex()<0 && $this->getWizardSteps()->getCount()>0)
773
+		if ($this->getActiveStepIndex() < 0 && $this->getWizardSteps()->getCount() > 0)
774 774
 			$this->setActiveStepIndex(0);
775 775
 	}
776 776
 
@@ -780,9 +780,9 @@  discard block
 block discarded – undo
780 780
 	 */
781 781
 	public function saveState()
782 782
 	{
783
-		$index=$this->getActiveStepIndex();
784
-		$history=$this->getHistory();
785
-		if(!$history->getCount() || $history->peek()!==$index)
783
+		$index = $this->getActiveStepIndex();
784
+		$history = $this->getHistory();
785
+		if (!$history->getCount() || $history->peek() !== $index)
786 786
 			$history->push($index);
787 787
 	}
788 788
 
@@ -791,7 +791,7 @@  discard block
 block discarded – undo
791 791
 	 */
792 792
 	protected function requiresControlsRecreation()
793 793
 	{
794
-		if($this->getChildControlsCreated())
794
+		if ($this->getChildControlsCreated())
795 795
 			$this->setChildControlsCreated(false);
796 796
 	}
797 797
 
@@ -802,9 +802,9 @@  discard block
 block discarded – undo
802 802
 	public function render($writer)
803 803
 	{
804 804
 		$this->ensureChildControls();
805
-		if($this->getHasControls())
805
+		if ($this->getHasControls())
806 806
 		{
807
-			if($this->getUseDefaultLayout())
807
+			if ($this->getUseDefaultLayout())
808 808
 			{
809 809
 				$this->applyControlProperties();
810 810
 				$this->renderBeginTag($writer);
@@ -846,9 +846,9 @@  discard block
 block discarded – undo
846 846
 	 */
847 847
 	protected function applyHeaderProperties()
848 848
 	{
849
-		if(($style=$this->getViewState('HeaderStyle',null))!==null)
849
+		if (($style = $this->getViewState('HeaderStyle', null)) !== null)
850 850
 			$this->_header->getStyle()->mergeWith($style);
851
-		if($this->getHeaderTemplate()===null)
851
+		if ($this->getHeaderTemplate() === null)
852 852
 		{
853 853
 			$this->_header->getControls()->clear();
854 854
 			$this->_header->getControls()->add($this->getHeaderText());
@@ -861,21 +861,21 @@  discard block
 block discarded – undo
861 861
 	protected function applySideBarProperties()
862 862
 	{
863 863
 		$this->_sideBar->setVisible($this->getShowSideBar());
864
-		if($this->_sideBarDataList!==null && $this->getShowSideBar())
864
+		if ($this->_sideBarDataList !== null && $this->getShowSideBar())
865 865
 		{
866 866
 			$this->_sideBarDataList->setDataSource($this->getWizardSteps());
867 867
 			$this->_sideBarDataList->setSelectedItemIndex($this->getActiveStepIndex());
868 868
 			$this->_sideBarDataList->dataBind();
869
-			if(($style=$this->getViewState('SideBarButtonStyle',null))!==null)
869
+			if (($style = $this->getViewState('SideBarButtonStyle', null)) !== null)
870 870
 			{
871
-				foreach($this->_sideBarDataList->getItems() as $item)
871
+				foreach ($this->_sideBarDataList->getItems() as $item)
872 872
 				{
873
-					if(($button=$item->findControl('SideBarButton'))!==null)
873
+					if (($button = $item->findControl('SideBarButton')) !== null)
874 874
 						$button->getStyle()->mergeWith($style);
875 875
 				}
876 876
 			}
877 877
 		}
878
-		if(($style=$this->getViewState('SideBarStyle',null))!==null)
878
+		if (($style = $this->getViewState('SideBarStyle', null)) !== null)
879 879
 			$this->_sideBar->getStyle()->mergeWith($style);
880 880
 	}
881 881
 
@@ -884,7 +884,7 @@  discard block
 block discarded – undo
884 884
 	 */
885 885
 	protected function applyStepContentProperties()
886 886
 	{
887
-		if(($style=$this->getViewState('StepStyle',null))!==null)
887
+		if (($style = $this->getViewState('StepStyle', null)) !== null)
888 888
 			$this->_stepContent->getStyle()->mergeWith($style);
889 889
 	}
890 890
 
@@ -893,116 +893,116 @@  discard block
 block discarded – undo
893 893
 	 */
894 894
 	protected function applyNavigationProperties()
895 895
 	{
896
-		$wizardSteps=$this->getWizardSteps();
897
-		$activeStep=$this->getActiveStep();
898
-		$activeStepIndex=$this->getActiveStepIndex();
896
+		$wizardSteps = $this->getWizardSteps();
897
+		$activeStep = $this->getActiveStep();
898
+		$activeStepIndex = $this->getActiveStepIndex();
899 899
 
900
-		if(!$this->_navigation)
900
+		if (!$this->_navigation)
901 901
 			return;
902
-		else if($activeStepIndex<0 || $activeStepIndex>=$wizardSteps->getCount())
902
+		else if ($activeStepIndex < 0 || $activeStepIndex >= $wizardSteps->getCount())
903 903
 		{
904 904
 			$this->_navigation->setVisible(false);
905 905
 			return;
906 906
 		}
907 907
 
908 908
 		// set visibility of different types of navigation panel
909
-		$showStandard=true;
910
-		foreach($wizardSteps as $step)
909
+		$showStandard = true;
910
+		foreach ($wizardSteps as $step)
911 911
 		{
912
-			if(($step instanceof TTemplatedWizardStep) && ($container=$step->getNavigationContainer())!==null)
912
+			if (($step instanceof TTemplatedWizardStep) && ($container = $step->getNavigationContainer()) !== null)
913 913
 			{
914
-				if($activeStep===$step)
914
+				if ($activeStep === $step)
915 915
 				{
916 916
 					$container->setVisible(true);
917
-					$showStandard=false;
917
+					$showStandard = false;
918 918
 				}
919 919
 				else
920 920
 					$container->setVisible(false);
921 921
 			}
922 922
 		}
923
-		$activeStepType=$this->getStepType($activeStep);
924
-		if($activeStepType===TWizardStepType::Complete)
923
+		$activeStepType = $this->getStepType($activeStep);
924
+		if ($activeStepType === TWizardStepType::Complete)
925 925
 		{
926 926
 			$this->_sideBar->setVisible(false);
927 927
 			$this->_header->setVisible(false);
928 928
 		}
929
-		$this->_startNavigation->setVisible($showStandard && $activeStepType===self::ST_START);
930
-		$this->_stepNavigation->setVisible($showStandard && $activeStepType===self::ST_STEP);
931
-		$this->_finishNavigation->setVisible($showStandard && $activeStepType===self::ST_FINISH);
929
+		$this->_startNavigation->setVisible($showStandard && $activeStepType === self::ST_START);
930
+		$this->_stepNavigation->setVisible($showStandard && $activeStepType === self::ST_STEP);
931
+		$this->_finishNavigation->setVisible($showStandard && $activeStepType === self::ST_FINISH);
932 932
 
933
-		if(($navigationStyle=$this->getViewState('NavigationStyle',null))!==null)
933
+		if (($navigationStyle = $this->getViewState('NavigationStyle', null)) !== null)
934 934
 			$this->_navigation->getStyle()->mergeWith($navigationStyle);
935 935
 
936
-		$displayCancelButton=$this->getShowCancelButton();
937
-		$cancelButtonStyle=$this->getCancelButtonStyle();
938
-		$buttonStyle=$this->getViewState('NavigationButtonStyle',null);
939
-		if($buttonStyle!==null)
936
+		$displayCancelButton = $this->getShowCancelButton();
937
+		$cancelButtonStyle = $this->getCancelButtonStyle();
938
+		$buttonStyle = $this->getViewState('NavigationButtonStyle', null);
939
+		if ($buttonStyle !== null)
940 940
 			$cancelButtonStyle->mergeWith($buttonStyle);
941 941
 
942 942
 		// apply styles to start navigation buttons
943
-		if(($cancelButton=$this->_startNavigation->getCancelButton())!==null)
943
+		if (($cancelButton = $this->_startNavigation->getCancelButton()) !== null)
944 944
 		{
945 945
 			$cancelButton->setVisible($displayCancelButton);
946 946
 			$cancelButtonStyle->apply($cancelButton);
947 947
 		}
948
-		if(($button=$this->_startNavigation->getNextButton())!==null)
948
+		if (($button = $this->_startNavigation->getNextButton()) !== null)
949 949
 		{
950 950
 			$button->setVisible(true);
951
-			$style=$this->getStartNextButtonStyle();
952
-			if($buttonStyle!==null)
951
+			$style = $this->getStartNextButtonStyle();
952
+			if ($buttonStyle !== null)
953 953
 				$style->mergeWith($buttonStyle);
954 954
 			$style->apply($button);
955
-			if($activeStepType===TWizardStepType::Start)
955
+			if ($activeStepType === TWizardStepType::Start)
956 956
 				$this->getPage()->getClientScript()->registerDefaultButton($this, $button);
957 957
 		}
958 958
 
959 959
 		// apply styles to finish navigation buttons
960
-		if(($cancelButton=$this->_finishNavigation->getCancelButton())!==null)
960
+		if (($cancelButton = $this->_finishNavigation->getCancelButton()) !== null)
961 961
 		{
962 962
 			$cancelButton->setVisible($displayCancelButton);
963 963
 			$cancelButtonStyle->apply($cancelButton);
964 964
 		}
965
-		if(($button=$this->_finishNavigation->getPreviousButton())!==null)
965
+		if (($button = $this->_finishNavigation->getPreviousButton()) !== null)
966 966
 		{
967 967
 			$button->setVisible($this->allowNavigationToPreviousStep());
968
-			$style=$this->getFinishPreviousButtonStyle();
969
-			if($buttonStyle!==null)
968
+			$style = $this->getFinishPreviousButtonStyle();
969
+			if ($buttonStyle !== null)
970 970
 				$style->mergeWith($buttonStyle);
971 971
 			$style->apply($button);
972 972
 		}
973
-		if(($button=$this->_finishNavigation->getCompleteButton())!==null)
973
+		if (($button = $this->_finishNavigation->getCompleteButton()) !== null)
974 974
 		{
975 975
 			$button->setVisible(true);
976
-			$style=$this->getFinishCompleteButtonStyle();
977
-			if($buttonStyle!==null)
976
+			$style = $this->getFinishCompleteButtonStyle();
977
+			if ($buttonStyle !== null)
978 978
 				$style->mergeWith($buttonStyle);
979 979
 			$style->apply($button);
980
-			if($activeStepType===TWizardStepType::Finish)
980
+			if ($activeStepType === TWizardStepType::Finish)
981 981
 				$this->getPage()->getClientScript()->registerDefaultButton($this, $button);
982 982
 		}
983 983
 
984 984
 		// apply styles to step navigation buttons
985
-		if(($cancelButton=$this->_stepNavigation->getCancelButton())!==null)
985
+		if (($cancelButton = $this->_stepNavigation->getCancelButton()) !== null)
986 986
 		{
987 987
 			$cancelButton->setVisible($displayCancelButton);
988 988
 			$cancelButtonStyle->apply($cancelButton);
989 989
 		}
990
-		if(($button=$this->_stepNavigation->getPreviousButton())!==null)
990
+		if (($button = $this->_stepNavigation->getPreviousButton()) !== null)
991 991
 		{
992 992
 			$button->setVisible($this->allowNavigationToPreviousStep());
993
-			$style=$this->getStepPreviousButtonStyle();
994
-			if($buttonStyle!==null)
993
+			$style = $this->getStepPreviousButtonStyle();
994
+			if ($buttonStyle !== null)
995 995
 				$style->mergeWith($buttonStyle);
996 996
 			$style->apply($button);
997 997
 		}
998
-		if(($button=$this->_stepNavigation->getNextButton())!==null)
998
+		if (($button = $this->_stepNavigation->getNextButton()) !== null)
999 999
 		{
1000 1000
 			$button->setVisible(true);
1001
-			$style=$this->getStepNextButtonStyle();
1002
-			if($buttonStyle!==null)
1001
+			$style = $this->getStepNextButtonStyle();
1002
+			if ($buttonStyle !== null)
1003 1003
 				$style->mergeWith($buttonStyle);
1004 1004
 			$style->apply($button);
1005
-			if($activeStepType===TWizardStepType::Step)
1005
+			if ($activeStepType === TWizardStepType::Step)
1006 1006
 				$this->getPage()->getClientScript()->registerDefaultButton($this, $button);
1007 1007
 		}
1008 1008
 	}
@@ -1012,10 +1012,10 @@  discard block
 block discarded – undo
1012 1012
 	 */
1013 1013
 	protected function getHistory()
1014 1014
 	{
1015
-		if(($history=$this->getControlState('History',null))===null)
1015
+		if (($history = $this->getControlState('History', null)) === null)
1016 1016
 		{
1017
-			$history=new TStack;
1018
-			$this->setControlState('History',$history);
1017
+			$history = new TStack;
1018
+			$this->setControlState('History', $history);
1019 1019
 		}
1020 1020
 		return $history;
1021 1021
 	}
@@ -1027,17 +1027,17 @@  discard block
 block discarded – undo
1027 1027
 	 */
1028 1028
 	protected function getStepType($wizardStep)
1029 1029
 	{
1030
-		if(($type=$wizardStep->getStepType())===TWizardStepType::Auto)
1030
+		if (($type = $wizardStep->getStepType()) === TWizardStepType::Auto)
1031 1031
 		{
1032
-			$steps=$this->getWizardSteps();
1033
-			if(($index=$steps->indexOf($wizardStep))>=0)
1032
+			$steps = $this->getWizardSteps();
1033
+			if (($index = $steps->indexOf($wizardStep)) >= 0)
1034 1034
 			{
1035
-				$stepCount=$steps->getCount();
1036
-				if($stepCount===1 || ($index<$stepCount-1 && $steps->itemAt($index+1)->getStepType()===TWizardStepType::Complete))
1035
+				$stepCount = $steps->getCount();
1036
+				if ($stepCount === 1 || ($index < $stepCount - 1 && $steps->itemAt($index + 1)->getStepType() === TWizardStepType::Complete))
1037 1037
 					return TWizardStepType::Finish;
1038
-				else if($index===0)
1038
+				else if ($index === 0)
1039 1039
 					return TWizardStepType::Start;
1040
-				else if($index===$stepCount-1)
1040
+				else if ($index === $stepCount - 1)
1041 1041
 					return TWizardStepType::Finish;
1042 1042
 				else
1043 1043
 					return TWizardStepType::Step;
@@ -1055,14 +1055,14 @@  discard block
 block discarded – undo
1055 1055
 	protected function reset()
1056 1056
 	{
1057 1057
 		$this->getControls()->clear();
1058
-		$this->_header=null;
1059
-		$this->_stepContent=null;
1060
-		$this->_sideBar=null;
1061
-		$this->_sideBarDataList=null;
1062
-		$this->_navigation=null;
1063
-		$this->_startNavigation=null;
1064
-		$this->_stepNavigation=null;
1065
-		$this->_finishNavigation=null;
1058
+		$this->_header = null;
1059
+		$this->_stepContent = null;
1060
+		$this->_sideBar = null;
1061
+		$this->_sideBarDataList = null;
1062
+		$this->_navigation = null;
1063
+		$this->_startNavigation = null;
1064
+		$this->_stepNavigation = null;
1065
+		$this->_finishNavigation = null;
1066 1066
 	}
1067 1067
 
1068 1068
 	/**
@@ -1083,8 +1083,8 @@  discard block
 block discarded – undo
1083 1083
 	 */
1084 1084
 	protected function createHeader()
1085 1085
 	{
1086
-		$this->_header=new TPanel;
1087
-		if(($template=$this->getHeaderTemplate())!==null)
1086
+		$this->_header = new TPanel;
1087
+		if (($template = $this->getHeaderTemplate()) !== null)
1088 1088
 			$template->instantiateIn($this->_header);
1089 1089
 		else
1090 1090
 			$this->_header->getControls()->add($this->getHeaderText());
@@ -1096,18 +1096,18 @@  discard block
 block discarded – undo
1096 1096
 	 */
1097 1097
 	protected function createSideBar()
1098 1098
 	{
1099
-		if($this->getShowSideBar())
1099
+		if ($this->getShowSideBar())
1100 1100
 		{
1101
-			if(($template=$this->getSideBarTemplate())===null)
1102
-				$template=new TWizardSideBarTemplate;
1103
-			$this->_sideBar=new TPanel;
1101
+			if (($template = $this->getSideBarTemplate()) === null)
1102
+				$template = new TWizardSideBarTemplate;
1103
+			$this->_sideBar = new TPanel;
1104 1104
 			$template->instantiateIn($this->_sideBar);
1105 1105
 			$this->getControls()->add($this->_sideBar);
1106 1106
 
1107
-			if(($this->_sideBarDataList=$this->_sideBar->findControl(self::ID_SIDEBAR_LIST))!==null)
1107
+			if (($this->_sideBarDataList = $this->_sideBar->findControl(self::ID_SIDEBAR_LIST)) !== null)
1108 1108
 			{
1109
-				$this->_sideBarDataList->attachEventHandler('OnItemCommand',array($this,'dataListItemCommand'));
1110
-				$this->_sideBarDataList->attachEventHandler('OnItemDataBound',array($this,'dataListItemDataBound'));
1109
+				$this->_sideBarDataList->attachEventHandler('OnItemCommand', array($this, 'dataListItemCommand'));
1110
+				$this->_sideBarDataList->attachEventHandler('OnItemDataBound', array($this, 'dataListItemDataBound'));
1111 1111
 				$this->_sideBarDataList->setDataSource($this->getWizardSteps());
1112 1112
 				$this->_sideBarDataList->setSelectedItemIndex($this->getActiveStepIndex());
1113 1113
 				$this->_sideBarDataList->dataBind();
@@ -1115,7 +1115,7 @@  discard block
 block discarded – undo
1115 1115
 		}
1116 1116
 		else
1117 1117
 		{
1118
-			$this->_sideBar=new TPanel;
1118
+			$this->_sideBar = new TPanel;
1119 1119
 			$this->getControls()->add($this->_sideBar);
1120 1120
 		}
1121 1121
 	}
@@ -1127,28 +1127,28 @@  discard block
 block discarded – undo
1127 1127
 	 * @param mixed sender of the event
1128 1128
 	 * @param TDataListCommandEventParameter
1129 1129
 	 */
1130
-	public function dataListItemCommand($sender,$param)
1130
+	public function dataListItemCommand($sender, $param)
1131 1131
 	{
1132
-		$item=$param->getItem();
1133
-		if($param->getCommandName()===self::CMD_MOVETO)
1132
+		$item = $param->getItem();
1133
+		if ($param->getCommandName() === self::CMD_MOVETO)
1134 1134
 		{
1135
-			$stepIndex=$this->getActiveStepIndex();
1136
-			$newStepIndex=TPropertyValue::ensureInteger($param->getCommandParameter());
1137
-			$navParam=new TWizardNavigationEventParameter($stepIndex);
1135
+			$stepIndex = $this->getActiveStepIndex();
1136
+			$newStepIndex = TPropertyValue::ensureInteger($param->getCommandParameter());
1137
+			$navParam = new TWizardNavigationEventParameter($stepIndex);
1138 1138
 			$navParam->setNextStepIndex($newStepIndex);
1139 1139
 
1140 1140
 			// if the button clicked causes validation which fails,
1141 1141
 			// by default we will cancel navigation to the new step
1142
-			$button=$param->getCommandSource();
1143
-			if(($button instanceof IButtonControl) && $button->getCausesValidation() && ($page=$this->getPage())!==null && !$page->getIsValid())
1142
+			$button = $param->getCommandSource();
1143
+			if (($button instanceof IButtonControl) && $button->getCausesValidation() && ($page = $this->getPage()) !== null && !$page->getIsValid())
1144 1144
 				$navParam->setCancelNavigation(true);
1145 1145
 
1146
-			$this->_activeStepIndexSet=false;
1146
+			$this->_activeStepIndexSet = false;
1147 1147
 			$this->onSideBarButtonClick($navParam);
1148
-			$this->_cancelNavigation=$navParam->getCancelNavigation();
1149
-			if(!$this->_cancelNavigation)
1148
+			$this->_cancelNavigation = $navParam->getCancelNavigation();
1149
+			if (!$this->_cancelNavigation)
1150 1150
 			{
1151
-				if(!$this->_activeStepIndexSet && $this->allowNavigationToStep($newStepIndex))
1151
+				if (!$this->_activeStepIndexSet && $this->allowNavigationToStep($newStepIndex))
1152 1152
 					$this->setActiveStepIndex($newStepIndex);
1153 1153
 			}
1154 1154
 			else
@@ -1163,22 +1163,22 @@  discard block
 block discarded – undo
1163 1163
 	 * @param mixed sender of the event
1164 1164
 	 * @param TDataListItemEventParameter
1165 1165
 	 */
1166
-	public function dataListItemDataBound($sender,$param)
1166
+	public function dataListItemDataBound($sender, $param)
1167 1167
 	{
1168
-		$item=$param->getItem();
1169
-		$itemType=$item->getItemType();
1170
-		if($itemType==='Item' || $itemType==='AlternatingItem' || $itemType==='SelectedItem' || $itemType==='EditItem')
1168
+		$item = $param->getItem();
1169
+		$itemType = $item->getItemType();
1170
+		if ($itemType === 'Item' || $itemType === 'AlternatingItem' || $itemType === 'SelectedItem' || $itemType === 'EditItem')
1171 1171
 		{
1172
-			if(($button=$item->findControl(self::ID_SIDEBAR_BUTTON))!==null)
1172
+			if (($button = $item->findControl(self::ID_SIDEBAR_BUTTON)) !== null)
1173 1173
 			{
1174
-				$step=$item->getData();
1175
-				if(($this->getStepType($step)===TWizardStepType::Complete))
1174
+				$step = $item->getData();
1175
+				if (($this->getStepType($step) === TWizardStepType::Complete))
1176 1176
 					$button->setEnabled(false);
1177
-				if(($title=$step->getTitle())!=='')
1177
+				if (($title = $step->getTitle()) !== '')
1178 1178
 					$button->setText($title);
1179 1179
 				else
1180 1180
 					$button->setText($step->getID(false));
1181
-				$index=$this->getWizardSteps()->indexOf($step);
1181
+				$index = $this->getWizardSteps()->indexOf($step);
1182 1182
 				$button->setCommandName(self::CMD_MOVETO);
1183 1183
 				$button->setCommandParameter("$index");
1184 1184
 			}
@@ -1190,16 +1190,16 @@  discard block
 block discarded – undo
1190 1190
 	 */
1191 1191
 	protected function createStepContent()
1192 1192
 	{
1193
-		foreach($this->getWizardSteps() as $step)
1193
+		foreach ($this->getWizardSteps() as $step)
1194 1194
 		{
1195
-			if($step instanceof TTemplatedWizardStep)
1195
+			if ($step instanceof TTemplatedWizardStep)
1196 1196
 				$step->ensureChildControls();
1197 1197
 		}
1198
-		$multiView=$this->getMultiView();
1199
-		$this->_stepContent=new TPanel;
1198
+		$multiView = $this->getMultiView();
1199
+		$this->_stepContent = new TPanel;
1200 1200
 		$this->_stepContent->getControls()->add($multiView);
1201 1201
 		$this->getControls()->add($this->_stepContent);
1202
-		if($multiView->getViews()->getCount())
1202
+		if ($multiView->getViews()->getCount())
1203 1203
 			$multiView->setActiveViewIndex(0);
1204 1204
 	}
1205 1205
 
@@ -1208,23 +1208,23 @@  discard block
 block discarded – undo
1208 1208
 	 */
1209 1209
 	protected function createNavigation()
1210 1210
 	{
1211
-		$this->_navigation=new TPanel;
1211
+		$this->_navigation = new TPanel;
1212 1212
 		$this->getControls()->add($this->_navigation);
1213
-		$controls=$this->_navigation->getControls();
1214
-		foreach($this->getWizardSteps() as $step)
1213
+		$controls = $this->_navigation->getControls();
1214
+		foreach ($this->getWizardSteps() as $step)
1215 1215
 		{
1216
-			if($step instanceof TTemplatedWizardStep)
1216
+			if ($step instanceof TTemplatedWizardStep)
1217 1217
 			{
1218 1218
 				$step->instantiateNavigationTemplate();
1219
-				if(($panel=$step->getNavigationContainer())!==null)
1219
+				if (($panel = $step->getNavigationContainer()) !== null)
1220 1220
 					$controls->add($panel);
1221 1221
 			}
1222 1222
 		}
1223
-		$this->_startNavigation=$this->createStartNavigation();
1223
+		$this->_startNavigation = $this->createStartNavigation();
1224 1224
 		$controls->add($this->_startNavigation);
1225
-		$this->_stepNavigation=$this->createStepNavigation();
1225
+		$this->_stepNavigation = $this->createStepNavigation();
1226 1226
 		$controls->add($this->_stepNavigation);
1227
-		$this->_finishNavigation=$this->createFinishNavigation();
1227
+		$this->_finishNavigation = $this->createFinishNavigation();
1228 1228
 		$controls->add($this->_finishNavigation);
1229 1229
 	}
1230 1230
 
@@ -1233,9 +1233,9 @@  discard block
 block discarded – undo
1233 1233
 	 */
1234 1234
 	protected function createStartNavigation()
1235 1235
 	{
1236
-		if(($template=$this->getStartNavigationTemplate())===null)
1237
-			$template=new TWizardStartNavigationTemplate($this);
1238
-		$navigation=new TWizardNavigationContainer;
1236
+		if (($template = $this->getStartNavigationTemplate()) === null)
1237
+			$template = new TWizardStartNavigationTemplate($this);
1238
+		$navigation = new TWizardNavigationContainer;
1239 1239
 		$template->instantiateIn($navigation);
1240 1240
 		return $navigation;
1241 1241
 	}
@@ -1245,9 +1245,9 @@  discard block
 block discarded – undo
1245 1245
 	 */
1246 1246
 	protected function createStepNavigation()
1247 1247
 	{
1248
-		if(($template=$this->getStepNavigationTemplate())===null)
1249
-			$template=new TWizardStepNavigationTemplate($this);
1250
-		$navigation=new TWizardNavigationContainer;
1248
+		if (($template = $this->getStepNavigationTemplate()) === null)
1249
+			$template = new TWizardStepNavigationTemplate($this);
1250
+		$navigation = new TWizardNavigationContainer;
1251 1251
 		$template->instantiateIn($navigation);
1252 1252
 		return $navigation;
1253 1253
 	}
@@ -1257,9 +1257,9 @@  discard block
 block discarded – undo
1257 1257
 	 */
1258 1258
 	protected function createFinishNavigation()
1259 1259
 	{
1260
-		if(($template=$this->getFinishNavigationTemplate())===null)
1261
-			$template=new TWizardFinishNavigationTemplate($this);
1262
-		$navigation=new TWizardNavigationContainer;
1260
+		if (($template = $this->getFinishNavigationTemplate()) === null)
1261
+			$template = new TWizardFinishNavigationTemplate($this);
1262
+		$navigation = new TWizardNavigationContainer;
1263 1263
 		$template->instantiateIn($navigation);
1264 1264
 		return $navigation;
1265 1265
 	}
@@ -1270,7 +1270,7 @@  discard block
 block discarded – undo
1270 1270
 	 */
1271 1271
 	public function wizardStepsChanged()
1272 1272
 	{
1273
-		if($this->_sideBarDataList!==null)
1273
+		if ($this->_sideBarDataList !== null)
1274 1274
 		{
1275 1275
 			$this->_sideBarDataList->setDataSource($this->getWizardSteps());
1276 1276
 			$this->_sideBarDataList->setSelectedItemIndex($this->getActiveStepIndex());
@@ -1285,28 +1285,28 @@  discard block
 block discarded – undo
1285 1285
 	 */
1286 1286
 	protected function getPreviousStepIndex($popStack)
1287 1287
 	{
1288
-		$history=$this->getHistory();
1289
-		if($history->getCount()>=0)
1288
+		$history = $this->getHistory();
1289
+		if ($history->getCount() >= 0)
1290 1290
 		{
1291
-			$activeStepIndex=$this->getActiveStepIndex();
1292
-			$previousStepIndex=-1;
1293
-			if($popStack)
1291
+			$activeStepIndex = $this->getActiveStepIndex();
1292
+			$previousStepIndex = -1;
1293
+			if ($popStack)
1294 1294
 			{
1295
-				$previousStepIndex=$history->pop();
1296
-				if($activeStepIndex===$previousStepIndex && $history->getCount()>0)
1297
-					$previousStepIndex=$history->pop();
1295
+				$previousStepIndex = $history->pop();
1296
+				if ($activeStepIndex === $previousStepIndex && $history->getCount() > 0)
1297
+					$previousStepIndex = $history->pop();
1298 1298
 			}
1299 1299
 			else
1300 1300
 			{
1301
-				$previousStepIndex=$history->peek();
1302
-				if($activeStepIndex===$previousStepIndex && $history->getCount()>1)
1301
+				$previousStepIndex = $history->peek();
1302
+				if ($activeStepIndex === $previousStepIndex && $history->getCount() > 1)
1303 1303
 				{
1304
-					$saveIndex=$history->pop();
1305
-					$previousStepIndex=$history->peek();
1304
+					$saveIndex = $history->pop();
1305
+					$previousStepIndex = $history->peek();
1306 1306
 					$history->push($saveIndex);
1307 1307
 				}
1308 1308
 			}
1309
-			return $activeStepIndex===$previousStepIndex ? -1 : $previousStepIndex;
1309
+			return $activeStepIndex === $previousStepIndex ? -1 : $previousStepIndex;
1310 1310
 		}
1311 1311
 		else
1312 1312
 			return -1;
@@ -1317,7 +1317,7 @@  discard block
 block discarded – undo
1317 1317
 	 */
1318 1318
 	protected function allowNavigationToPreviousStep()
1319 1319
 	{
1320
-		if(($index=$this->getPreviousStepIndex(false))!==-1)
1320
+		if (($index = $this->getPreviousStepIndex(false)) !== -1)
1321 1321
 			return $this->getWizardSteps()->itemAt($index)->getAllowReturn();
1322 1322
 		else
1323 1323
 			return false;
@@ -1329,7 +1329,7 @@  discard block
 block discarded – undo
1329 1329
 	 */
1330 1330
 	protected function allowNavigationToStep($index)
1331 1331
 	{
1332
-		if($this->getHistory()->contains($index))
1332
+		if ($this->getHistory()->contains($index))
1333 1333
 			return $this->getWizardSteps()->itemAt($index)->getAllowReturn();
1334 1334
 		else
1335 1335
 			return true;
@@ -1343,87 +1343,87 @@  discard block
 block discarded – undo
1343 1343
 	 * @param TEventParameter event parameter
1344 1344
 	 * @throws TInvalidDataValueException if a navigation command is associated with an invalid parameter
1345 1345
 	 */
1346
-	public function bubbleEvent($sender,$param)
1346
+	public function bubbleEvent($sender, $param)
1347 1347
 	{
1348
-		if($param instanceof TCommandEventParameter)
1348
+		if ($param instanceof TCommandEventParameter)
1349 1349
 		{
1350
-			$command=$param->getCommandName();
1351
-			if(strcasecmp($command,self::CMD_CANCEL)===0)
1350
+			$command = $param->getCommandName();
1351
+			if (strcasecmp($command, self::CMD_CANCEL) === 0)
1352 1352
 			{
1353 1353
 				$this->onCancelButtonClick($param);
1354 1354
 				return true;
1355 1355
 			}
1356 1356
 
1357
-			$type=$this->getStepType($this->getActiveStep());
1358
-			$index=$this->getActiveStepIndex();
1359
-			$navParam=new TWizardNavigationEventParameter($index);
1360
-			if(($sender instanceof IButtonControl) && $sender->getCausesValidation() && ($page=$this->getPage())!==null && !$page->getIsValid())
1357
+			$type = $this->getStepType($this->getActiveStep());
1358
+			$index = $this->getActiveStepIndex();
1359
+			$navParam = new TWizardNavigationEventParameter($index);
1360
+			if (($sender instanceof IButtonControl) && $sender->getCausesValidation() && ($page = $this->getPage()) !== null && !$page->getIsValid())
1361 1361
 				$navParam->setCancelNavigation(true);
1362 1362
 
1363
-			$handled=false;
1364
-			$movePrev=false;
1365
-			$this->_activeStepIndexSet=false;
1363
+			$handled = false;
1364
+			$movePrev = false;
1365
+			$this->_activeStepIndexSet = false;
1366 1366
 
1367
-			if(strcasecmp($command,self::CMD_NEXT)===0)
1367
+			if (strcasecmp($command, self::CMD_NEXT) === 0)
1368 1368
 			{
1369
-				if($type!==self::ST_START && $type!==self::ST_STEP)
1370
-					throw new TInvalidDataValueException('wizard_command_invalid',self::CMD_NEXT);
1371
-				if($index<$this->getWizardSteps()->getCount()-1)
1372
-					$navParam->setNextStepIndex($index+1);
1369
+				if ($type !== self::ST_START && $type !== self::ST_STEP)
1370
+					throw new TInvalidDataValueException('wizard_command_invalid', self::CMD_NEXT);
1371
+				if ($index < $this->getWizardSteps()->getCount() - 1)
1372
+					$navParam->setNextStepIndex($index + 1);
1373 1373
 				$this->onNextButtonClick($navParam);
1374
-				$handled=true;
1374
+				$handled = true;
1375 1375
 			}
1376
-			else if(strcasecmp($command,self::CMD_PREVIOUS)===0)
1376
+			else if (strcasecmp($command, self::CMD_PREVIOUS) === 0)
1377 1377
 			{
1378
-				if($type!==self::ST_FINISH && $type!==self::ST_STEP)
1379
-					throw new TInvalidDataValueException('wizard_command_invalid',self::CMD_PREVIOUS);
1380
-				$movePrev=true;
1381
-				if(($prevIndex=$this->getPreviousStepIndex(false))>=0)
1378
+				if ($type !== self::ST_FINISH && $type !== self::ST_STEP)
1379
+					throw new TInvalidDataValueException('wizard_command_invalid', self::CMD_PREVIOUS);
1380
+				$movePrev = true;
1381
+				if (($prevIndex = $this->getPreviousStepIndex(false)) >= 0)
1382 1382
 					$navParam->setNextStepIndex($prevIndex);
1383 1383
 				$this->onPreviousButtonClick($navParam);
1384
-				$handled=true;
1384
+				$handled = true;
1385 1385
 			}
1386
-			else if(strcasecmp($command,self::CMD_COMPLETE)===0)
1386
+			else if (strcasecmp($command, self::CMD_COMPLETE) === 0)
1387 1387
 			{
1388
-				if($type!==self::ST_FINISH)
1389
-					throw new TInvalidDataValueException('wizard_command_invalid',self::CMD_COMPLETE);
1390
-				if($index<$this->getWizardSteps()->getCount()-1)
1391
-					$navParam->setNextStepIndex($index+1);
1388
+				if ($type !== self::ST_FINISH)
1389
+					throw new TInvalidDataValueException('wizard_command_invalid', self::CMD_COMPLETE);
1390
+				if ($index < $this->getWizardSteps()->getCount() - 1)
1391
+					$navParam->setNextStepIndex($index + 1);
1392 1392
 				$this->onCompleteButtonClick($navParam);
1393
-				$handled=true;
1393
+				$handled = true;
1394 1394
 			}
1395
-			else if(strcasecmp($command,self::CMD_MOVETO)===0)
1395
+			else if (strcasecmp($command, self::CMD_MOVETO) === 0)
1396 1396
 			{
1397
-				if($this->_cancelNavigation)  // may be set in onSideBarButtonClick
1397
+				if ($this->_cancelNavigation)  // may be set in onSideBarButtonClick
1398 1398
 					$navParam->setCancelNavigation(true);
1399
-				$requestedStep=$param->getCommandParameter();
1399
+				$requestedStep = $param->getCommandParameter();
1400 1400
 				if (!is_numeric($requestedStep))
1401 1401
 				{
1402
-					$requestedIndex=-1;
1402
+					$requestedIndex = -1;
1403 1403
 					foreach ($this->getWizardSteps() as $index=>$step)
1404
-						if ($step->getId()===$requestedStep)
1404
+						if ($step->getId() === $requestedStep)
1405 1405
 						{
1406
-							$requestedIndex=$index;
1406
+							$requestedIndex = $index;
1407 1407
 							break;
1408 1408
 						}
1409
-					if ($requestedIndex<0)
1409
+					if ($requestedIndex < 0)
1410 1410
 						throw new TConfigurationException('wizard_step_invalid');
1411 1411
 				}
1412 1412
 				else
1413
-					$requestedIndex=TPropertyValue::ensureInteger($requestedStep);
1413
+					$requestedIndex = TPropertyValue::ensureInteger($requestedStep);
1414 1414
 				$navParam->setNextStepIndex($requestedIndex);
1415
-				$handled=true;
1415
+				$handled = true;
1416 1416
 			}
1417 1417
 
1418
-			if($handled)
1418
+			if ($handled)
1419 1419
 			{
1420
-				if(!$navParam->getCancelNavigation())
1420
+				if (!$navParam->getCancelNavigation())
1421 1421
 				{
1422
-					$nextStepIndex=$navParam->getNextStepIndex();
1423
-					if(!$this->_activeStepIndexSet && $this->allowNavigationToStep($nextStepIndex))
1422
+					$nextStepIndex = $navParam->getNextStepIndex();
1423
+					if (!$this->_activeStepIndexSet && $this->allowNavigationToStep($nextStepIndex))
1424 1424
 					{
1425
-						if($movePrev)
1426
-							$this->getPreviousStepIndex(true);  // pop out the previous move from history
1425
+						if ($movePrev)
1426
+							$this->getPreviousStepIndex(true); // pop out the previous move from history
1427 1427
 						$this->setActiveStepIndex($nextStepIndex);
1428 1428
 					}
1429 1429
 				}
@@ -1469,7 +1469,7 @@  discard block
 block discarded – undo
1469 1469
 	 */
1470 1470
 	public function setWizard($wizard)
1471 1471
 	{
1472
-		$this->_wizard=$wizard;
1472
+		$this->_wizard = $wizard;
1473 1473
 	}
1474 1474
 
1475 1475
 	/**
@@ -1477,7 +1477,7 @@  discard block
 block discarded – undo
1477 1477
 	 */
1478 1478
 	public function getTitle()
1479 1479
 	{
1480
-		return $this->getViewState('Title','');
1480
+		return $this->getViewState('Title', '');
1481 1481
 	}
1482 1482
 
1483 1483
 	/**
@@ -1485,8 +1485,8 @@  discard block
 block discarded – undo
1485 1485
 	 */
1486 1486
 	public function setTitle($value)
1487 1487
 	{
1488
-		$this->setViewState('Title',$value,'');
1489
-		if($this->_wizard)
1488
+		$this->setViewState('Title', $value, '');
1489
+		if ($this->_wizard)
1490 1490
 			$this->_wizard->wizardStepsChanged();
1491 1491
 	}
1492 1492
 
@@ -1495,7 +1495,7 @@  discard block
 block discarded – undo
1495 1495
 	 */
1496 1496
 	public function getAllowReturn()
1497 1497
 	{
1498
-		return $this->getViewState('AllowReturn',true);
1498
+		return $this->getViewState('AllowReturn', true);
1499 1499
 	}
1500 1500
 
1501 1501
 	/**
@@ -1503,7 +1503,7 @@  discard block
 block discarded – undo
1503 1503
 	 */
1504 1504
 	public function setAllowReturn($value)
1505 1505
 	{
1506
-		$this->setViewState('AllowReturn',TPropertyValue::ensureBoolean($value),true);
1506
+		$this->setViewState('AllowReturn', TPropertyValue::ensureBoolean($value), true);
1507 1507
 	}
1508 1508
 
1509 1509
 	/**
@@ -1511,7 +1511,7 @@  discard block
 block discarded – undo
1511 1511
 	 */
1512 1512
 	public function getStepType()
1513 1513
 	{
1514
-		return $this->getViewState('StepType',TWizardStepType::Auto);
1514
+		return $this->getViewState('StepType', TWizardStepType::Auto);
1515 1515
 	}
1516 1516
 
1517 1517
 	/**
@@ -1519,11 +1519,11 @@  discard block
 block discarded – undo
1519 1519
 	 */
1520 1520
 	public function setStepType($type)
1521 1521
 	{
1522
-		$type=TPropertyValue::ensureEnum($type,'TWizardStepType');
1523
-		if($type!==$this->getStepType())
1522
+		$type = TPropertyValue::ensureEnum($type, 'TWizardStepType');
1523
+		if ($type !== $this->getStepType())
1524 1524
 		{
1525
-			$this->setViewState('StepType',$type,TWizardStepType::Auto);
1526
-			if($this->_wizard)
1525
+			$this->setViewState('StepType', $type, TWizardStepType::Auto);
1526
+			if ($this->_wizard)
1527 1527
 				$this->_wizard->wizardStepsChanged();
1528 1528
 		}
1529 1529
 	}
@@ -1578,15 +1578,15 @@  discard block
 block discarded – undo
1578 1578
 	/**
1579 1579
 	 * @var ITemplate the template for displaying the navigation UI of a wizard step.
1580 1580
 	 */
1581
-	private $_navigationTemplate=null;
1581
+	private $_navigationTemplate = null;
1582 1582
 	/**
1583 1583
 	 * @var ITemplate the template for displaying the content within the wizard step.
1584 1584
 	 */
1585
-	private $_contentTemplate=null;
1585
+	private $_contentTemplate = null;
1586 1586
 	/**
1587 1587
 	 * @var TWizardNavigationContainer
1588 1588
 	 */
1589
-	private $_navigationContainer=null;
1589
+	private $_navigationContainer = null;
1590 1590
 
1591 1591
 	/**
1592 1592
 	 * Creates child controls.
@@ -1595,7 +1595,7 @@  discard block
 block discarded – undo
1595 1595
 	public function createChildControls()
1596 1596
 	{
1597 1597
 		$this->getControls()->clear();
1598
-		if($this->_contentTemplate)
1598
+		if ($this->_contentTemplate)
1599 1599
 			$this->_contentTemplate->instantiateIn($this);
1600 1600
 	}
1601 1601
 
@@ -1622,7 +1622,7 @@  discard block
 block discarded – undo
1622 1622
 	 */
1623 1623
 	public function setContentTemplate($value)
1624 1624
 	{
1625
-		$this->_contentTemplate=$value;
1625
+		$this->_contentTemplate = $value;
1626 1626
 	}
1627 1627
 
1628 1628
 	/**
@@ -1638,7 +1638,7 @@  discard block
 block discarded – undo
1638 1638
 	 */
1639 1639
 	public function setNavigationTemplate($value)
1640 1640
 	{
1641
-		$this->_navigationTemplate=$value;
1641
+		$this->_navigationTemplate = $value;
1642 1642
 	}
1643 1643
 
1644 1644
 	/**
@@ -1655,9 +1655,9 @@  discard block
 block discarded – undo
1655 1655
 	 */
1656 1656
 	public function instantiateNavigationTemplate()
1657 1657
 	{
1658
-		if(!$this->_navigationContainer && $this->_navigationTemplate)
1658
+		if (!$this->_navigationContainer && $this->_navigationTemplate)
1659 1659
 		{
1660
-			$this->_navigationContainer=new TWizardNavigationContainer;
1660
+			$this->_navigationContainer = new TWizardNavigationContainer;
1661 1661
 			$this->_navigationTemplate->instantiateIn($this->_navigationContainer);
1662 1662
 		}
1663 1663
 	}
@@ -1687,7 +1687,7 @@  discard block
 block discarded – undo
1687 1687
 	 */
1688 1688
 	public function __construct(TWizard $wizard)
1689 1689
 	{
1690
-		$this->_wizard=$wizard;
1690
+		$this->_wizard = $wizard;
1691 1691
 	}
1692 1692
 
1693 1693
 	/**
@@ -1698,12 +1698,12 @@  discard block
 block discarded – undo
1698 1698
 	 * @param mixed new item
1699 1699
 	 * @throws TInvalidDataTypeException if the item being added is not TWizardStep.
1700 1700
 	 */
1701
-	public function insertAt($index,$item)
1701
+	public function insertAt($index, $item)
1702 1702
 	{
1703
-		if($item instanceof TWizardStep)
1703
+		if ($item instanceof TWizardStep)
1704 1704
 		{
1705
-			parent::insertAt($index,$item);
1706
-			$this->_wizard->getMultiView()->getViews()->insertAt($index,$item);
1705
+			parent::insertAt($index, $item);
1706
+			$this->_wizard->getMultiView()->getViews()->insertAt($index, $item);
1707 1707
 			$this->_wizard->addedWizardStep($item);
1708 1708
 		}
1709 1709
 		else
@@ -1717,7 +1717,7 @@  discard block
 block discarded – undo
1717 1717
 	 */
1718 1718
 	public function removeAt($index)
1719 1719
 	{
1720
-		$step=parent::removeAt($index);
1720
+		$step = parent::removeAt($index);
1721 1721
 		$this->_wizard->getMultiView()->getViews()->remove($step);
1722 1722
 		$this->_wizard->removedWizardStep($step);
1723 1723
 		return $step;
@@ -1739,10 +1739,10 @@  discard block
 block discarded – undo
1739 1739
  */
1740 1740
 class TWizardNavigationContainer extends TControl implements INamingContainer
1741 1741
 {
1742
-	private $_previousButton=null;
1743
-	private $_nextButton=null;
1744
-	private $_cancelButton=null;
1745
-	private $_completeButton=null;
1742
+	private $_previousButton = null;
1743
+	private $_nextButton = null;
1744
+	private $_cancelButton = null;
1745
+	private $_completeButton = null;
1746 1746
 
1747 1747
 	/**
1748 1748
 	 * @return mixed the previous button
@@ -1757,7 +1757,7 @@  discard block
 block discarded – undo
1757 1757
 	 */
1758 1758
 	public function setPreviousButton($value)
1759 1759
 	{
1760
-		$this->_previousButton=$value;
1760
+		$this->_previousButton = $value;
1761 1761
 	}
1762 1762
 
1763 1763
 	/**
@@ -1773,7 +1773,7 @@  discard block
 block discarded – undo
1773 1773
 	 */
1774 1774
 	public function setNextButton($value)
1775 1775
 	{
1776
-		$this->_nextButton=$value;
1776
+		$this->_nextButton = $value;
1777 1777
 	}
1778 1778
 
1779 1779
 	/**
@@ -1789,7 +1789,7 @@  discard block
 block discarded – undo
1789 1789
 	 */
1790 1790
 	public function setCancelButton($value)
1791 1791
 	{
1792
-		$this->_cancelButton=$value;
1792
+		$this->_cancelButton = $value;
1793 1793
 	}
1794 1794
 
1795 1795
 	/**
@@ -1805,7 +1805,7 @@  discard block
 block discarded – undo
1805 1805
 	 */
1806 1806
 	public function setCompleteButton($value)
1807 1807
 	{
1808
-		$this->_completeButton=$value;
1808
+		$this->_completeButton = $value;
1809 1809
 	}
1810 1810
 }
1811 1811
 
@@ -1830,7 +1830,7 @@  discard block
 block discarded – undo
1830 1830
  */
1831 1831
 class TWizardNavigationEventParameter extends TEventParameter
1832 1832
 {
1833
-	private $_cancel=false;
1833
+	private $_cancel = false;
1834 1834
 	private $_currentStep;
1835 1835
 	private $_nextStep;
1836 1836
 
@@ -1840,8 +1840,8 @@  discard block
 block discarded – undo
1840 1840
 	 */
1841 1841
 	public function __construct($currentStep)
1842 1842
 	{
1843
-		$this->_currentStep=$currentStep;
1844
-		$this->_nextStep=$currentStep;
1843
+		$this->_currentStep = $currentStep;
1844
+		$this->_nextStep = $currentStep;
1845 1845
 	}
1846 1846
 
1847 1847
 	/**
@@ -1865,7 +1865,7 @@  discard block
 block discarded – undo
1865 1865
 	 */
1866 1866
 	public function setNextStepIndex($index)
1867 1867
 	{
1868
-		$this->_nextStep=TPropertyValue::ensureInteger($index);
1868
+		$this->_nextStep = TPropertyValue::ensureInteger($index);
1869 1869
 	}
1870 1870
 
1871 1871
 	/**
@@ -1881,7 +1881,7 @@  discard block
 block discarded – undo
1881 1881
 	 */
1882 1882
 	public function setCancelNavigation($value)
1883 1883
 	{
1884
-		$this->_cancel=TPropertyValue::ensureBoolean($value);
1884
+		$this->_cancel = TPropertyValue::ensureBoolean($value);
1885 1885
 	}
1886 1886
 }
1887 1887
 
@@ -1901,7 +1901,7 @@  discard block
 block discarded – undo
1901 1901
 	 */
1902 1902
 	public function instantiateIn($parent)
1903 1903
 	{
1904
-		$dataList=new TDataList;
1904
+		$dataList = new TDataList;
1905 1905
 		$dataList->setID(TWizard::ID_SIDEBAR_LIST);
1906 1906
 		$dataList->getSelectedItemStyle()->getFont()->setBold(true);
1907 1907
 		$dataList->setItemTemplate(new TWizardSideBarListItemTemplate);
@@ -1925,7 +1925,7 @@  discard block
 block discarded – undo
1925 1925
 	 */
1926 1926
 	public function instantiateIn($parent)
1927 1927
 	{
1928
-		$button=new TLinkButton;
1928
+		$button = new TLinkButton;
1929 1929
 		$button->setID(TWizard::ID_SIDEBAR_BUTTON);
1930 1930
 		$parent->getControls()->add($button);
1931 1931
 	}
@@ -1948,7 +1948,7 @@  discard block
 block discarded – undo
1948 1948
 	 */
1949 1949
 	public function __construct($wizard)
1950 1950
 	{
1951
-		$this->_wizard=$wizard;
1951
+		$this->_wizard = $wizard;
1952 1952
 	}
1953 1953
 
1954 1954
 	/**
@@ -1977,22 +1977,22 @@  discard block
 block discarded – undo
1977 1977
 	 * @param string command name for the button's OnCommand event
1978 1978
 	 * @throws TInvalidDataValueException if the button type is not recognized
1979 1979
 	 */
1980
-	protected function createNavigationButton($buttonStyle,$causesValidation,$commandName)
1980
+	protected function createNavigationButton($buttonStyle, $causesValidation, $commandName)
1981 1981
 	{
1982
-		switch($buttonStyle->getButtonType())
1982
+		switch ($buttonStyle->getButtonType())
1983 1983
 		{
1984 1984
 			case TWizardNavigationButtonType::Button:
1985
-				$button=new TButton;
1985
+				$button = new TButton;
1986 1986
 				break;
1987 1987
 			case TWizardNavigationButtonType::Link:
1988
-				$button=new TLinkButton;
1988
+				$button = new TLinkButton;
1989 1989
 				break;
1990 1990
 			case TWizardNavigationButtonType::Image:
1991
-				$button=new TImageButton;
1991
+				$button = new TImageButton;
1992 1992
 				$button->setImageUrl($buttonStyle->getImageUrl());
1993 1993
 				break;
1994 1994
 			default:
1995
-				throw new TInvalidDataValueException('wizard_buttontype_unknown',$buttonStyle->getButtonType());
1995
+				throw new TInvalidDataValueException('wizard_buttontype_unknown', $buttonStyle->getButtonType());
1996 1996
 		}
1997 1997
 		$button->setText($buttonStyle->getButtonText());
1998 1998
 		$button->setCausesValidation($causesValidation);
@@ -2017,10 +2017,10 @@  discard block
 block discarded – undo
2017 2017
 	 */
2018 2018
 	public function instantiateIn($parent)
2019 2019
 	{
2020
-		$nextButton=$this->createNavigationButton($this->getWizard()->getStartNextButtonStyle(),true,TWizard::CMD_NEXT);
2021
-		$cancelButton=$this->createNavigationButton($this->getWizard()->getCancelButtonStyle(),false,TWizard::CMD_CANCEL);
2020
+		$nextButton = $this->createNavigationButton($this->getWizard()->getStartNextButtonStyle(), true, TWizard::CMD_NEXT);
2021
+		$cancelButton = $this->createNavigationButton($this->getWizard()->getCancelButtonStyle(), false, TWizard::CMD_CANCEL);
2022 2022
 
2023
-		$controls=$parent->getControls();
2023
+		$controls = $parent->getControls();
2024 2024
 		$controls->add($nextButton);
2025 2025
 		$controls->add("\n");
2026 2026
 		$controls->add($cancelButton);
@@ -2046,11 +2046,11 @@  discard block
 block discarded – undo
2046 2046
 	 */
2047 2047
 	public function instantiateIn($parent)
2048 2048
 	{
2049
-		$previousButton=$this->createNavigationButton($this->getWizard()->getFinishPreviousButtonStyle(),false,TWizard::CMD_PREVIOUS);
2050
-		$completeButton=$this->createNavigationButton($this->getWizard()->getFinishCompleteButtonStyle(),true,TWizard::CMD_COMPLETE);
2051
-		$cancelButton=$this->createNavigationButton($this->getWizard()->getCancelButtonStyle(),false,TWizard::CMD_CANCEL);
2049
+		$previousButton = $this->createNavigationButton($this->getWizard()->getFinishPreviousButtonStyle(), false, TWizard::CMD_PREVIOUS);
2050
+		$completeButton = $this->createNavigationButton($this->getWizard()->getFinishCompleteButtonStyle(), true, TWizard::CMD_COMPLETE);
2051
+		$cancelButton = $this->createNavigationButton($this->getWizard()->getCancelButtonStyle(), false, TWizard::CMD_CANCEL);
2052 2052
 
2053
-		$controls=$parent->getControls();
2053
+		$controls = $parent->getControls();
2054 2054
 		$controls->add($previousButton);
2055 2055
 		$controls->add("\n");
2056 2056
 		$controls->add($completeButton);
@@ -2079,11 +2079,11 @@  discard block
 block discarded – undo
2079 2079
 	 */
2080 2080
 	public function instantiateIn($parent)
2081 2081
 	{
2082
-		$previousButton=$this->createNavigationButton($this->getWizard()->getStepPreviousButtonStyle(),false,TWizard::CMD_PREVIOUS);
2083
-		$nextButton=$this->createNavigationButton($this->getWizard()->getStepNextButtonStyle(),true,TWizard::CMD_NEXT);
2084
-		$cancelButton=$this->createNavigationButton($this->getWizard()->getCancelButtonStyle(),false,TWizard::CMD_CANCEL);
2082
+		$previousButton = $this->createNavigationButton($this->getWizard()->getStepPreviousButtonStyle(), false, TWizard::CMD_PREVIOUS);
2083
+		$nextButton = $this->createNavigationButton($this->getWizard()->getStepNextButtonStyle(), true, TWizard::CMD_NEXT);
2084
+		$cancelButton = $this->createNavigationButton($this->getWizard()->getCancelButtonStyle(), false, TWizard::CMD_CANCEL);
2085 2085
 
2086
-		$controls=$parent->getControls();
2086
+		$controls = $parent->getControls();
2087 2087
 		$controls->add($previousButton);
2088 2088
 		$controls->add("\n");
2089 2089
 		$controls->add($nextButton);
@@ -2113,9 +2113,9 @@  discard block
 block discarded – undo
2113 2113
  */
2114 2114
 class TWizardNavigationButtonType extends TEnumerable
2115 2115
 {
2116
-	const Button='Button';
2117
-	const Image='Image';
2118
-	const Link='Link';
2116
+	const Button = 'Button';
2117
+	const Image = 'Image';
2118
+	const Link = 'Link';
2119 2119
 }
2120 2120
 
2121 2121
 
@@ -2136,10 +2136,10 @@  discard block
 block discarded – undo
2136 2136
  */
2137 2137
 class TWizardStepType extends TEnumerable
2138 2138
 {
2139
-	const Auto='Auto';
2140
-	const Complete='Complete';
2141
-	const Start='Start';
2142
-	const Step='Step';
2143
-	const Finish='Finish';
2139
+	const Auto = 'Auto';
2140
+	const Complete = 'Complete';
2141
+	const Start = 'Start';
2142
+	const Step = 'Step';
2143
+	const Finish = 'Finish';
2144 2144
 }
2145 2145
 
Please login to merge, or discard this patch.
Braces   +199 added lines, -150 removed lines patch added patch discarded remove patch
@@ -192,8 +192,9 @@  discard block
 block discarded – undo
192 192
 	 */
193 193
 	public function addParsedObject($object)
194 194
 	{
195
-		if($object instanceof TWizardStep)
196
-			$this->getWizardSteps()->add($object);
195
+		if($object instanceof TWizardStep) {
196
+					$this->getWizardSteps()->add($object);
197
+		}
197 198
 	}
198 199
 
199 200
 	/**
@@ -210,8 +211,9 @@  discard block
 block discarded – undo
210 211
 	 */
211 212
 	public function setActiveStep($step)
212 213
 	{
213
-		if(($index=$this->getWizardSteps()->indexOf($step))<0)
214
-			throw new TInvalidOperationException('wizard_step_invalid');
214
+		if(($index=$this->getWizardSteps()->indexOf($step))<0) {
215
+					throw new TInvalidOperationException('wizard_step_invalid');
216
+		}
215 217
 		$this->setActiveStepIndex($index);
216 218
 	}
217 219
 
@@ -247,8 +249,9 @@  discard block
 block discarded – undo
247 249
 	 */
248 250
 	public function getWizardSteps()
249 251
 	{
250
-		if($this->_wizardSteps===null)
251
-			$this->_wizardSteps=new TWizardStepCollection($this);
252
+		if($this->_wizardSteps===null) {
253
+					$this->_wizardSteps=new TWizardStepCollection($this);
254
+		}
252 255
 		return $this->_wizardSteps;
253 256
 	}
254 257
 
@@ -668,8 +671,9 @@  discard block
 block discarded – undo
668 671
 	public function onCancelButtonClick($param)
669 672
 	{
670 673
 		$this->raiseEvent('OnCancelButtonClick',$this,$param);
671
-		if(($url=$this->getCancelDestinationUrl())!=='')
672
-			$this->getResponse()->redirect($url);
674
+		if(($url=$this->getCancelDestinationUrl())!=='') {
675
+					$this->getResponse()->redirect($url);
676
+		}
673 677
 	}
674 678
 
675 679
 	/**
@@ -681,8 +685,9 @@  discard block
 block discarded – undo
681 685
 	public function onCompleteButtonClick($param)
682 686
 	{
683 687
 		$this->raiseEvent('OnCompleteButtonClick',$this,$param);
684
-		if(($url=$this->getFinishDestinationUrl())!=='')
685
-			$this->getResponse()->redirect($url);
688
+		if(($url=$this->getFinishDestinationUrl())!=='') {
689
+					$this->getResponse()->redirect($url);
690
+		}
686 691
 	}
687 692
 
688 693
 	/**
@@ -742,8 +747,9 @@  discard block
 block discarded – undo
742 747
 	 */
743 748
 	public function addedWizardStep($step)
744 749
 	{
745
-		if(($wizard=$step->getWizard())!==null)
746
-			$wizard->getWizardSteps()->remove($step);
750
+		if(($wizard=$step->getWizard())!==null) {
751
+					$wizard->getWizardSteps()->remove($step);
752
+		}
747 753
 		$step->setWizard($this);
748 754
 		$this->wizardStepsChanged();
749 755
 	}
@@ -770,8 +776,9 @@  discard block
 block discarded – undo
770 776
 		parent::onInit($param);
771 777
 		$this->ensureChildControls();
772 778
 		$this->setEnsureId(true);
773
-		if($this->getActiveStepIndex()<0 && $this->getWizardSteps()->getCount()>0)
774
-			$this->setActiveStepIndex(0);
779
+		if($this->getActiveStepIndex()<0 && $this->getWizardSteps()->getCount()>0) {
780
+					$this->setActiveStepIndex(0);
781
+		}
775 782
 	}
776 783
 
777 784
 	/**
@@ -782,8 +789,9 @@  discard block
 block discarded – undo
782 789
 	{
783 790
 		$index=$this->getActiveStepIndex();
784 791
 		$history=$this->getHistory();
785
-		if(!$history->getCount() || $history->peek()!==$index)
786
-			$history->push($index);
792
+		if(!$history->getCount() || $history->peek()!==$index) {
793
+					$history->push($index);
794
+		}
787 795
 	}
788 796
 
789 797
 	/**
@@ -791,8 +799,9 @@  discard block
 block discarded – undo
791 799
 	 */
792 800
 	protected function requiresControlsRecreation()
793 801
 	{
794
-		if($this->getChildControlsCreated())
795
-			$this->setChildControlsCreated(false);
802
+		if($this->getChildControlsCreated()) {
803
+					$this->setChildControlsCreated(false);
804
+		}
796 805
 	}
797 806
 
798 807
 	/**
@@ -816,8 +825,7 @@  discard block
 block discarded – undo
816 825
 				$this->_navigation->renderControl($writer);
817 826
 				$writer->write("\n</td></tr></table>\n");
818 827
 				$this->renderEndTag($writer);
819
-			}
820
-			else
828
+			} else
821 829
 			{
822 830
 				$this->applyControlProperties();
823 831
 				$this->renderBeginTag($writer);
@@ -846,8 +854,9 @@  discard block
 block discarded – undo
846 854
 	 */
847 855
 	protected function applyHeaderProperties()
848 856
 	{
849
-		if(($style=$this->getViewState('HeaderStyle',null))!==null)
850
-			$this->_header->getStyle()->mergeWith($style);
857
+		if(($style=$this->getViewState('HeaderStyle',null))!==null) {
858
+					$this->_header->getStyle()->mergeWith($style);
859
+		}
851 860
 		if($this->getHeaderTemplate()===null)
852 861
 		{
853 862
 			$this->_header->getControls()->clear();
@@ -870,13 +879,15 @@  discard block
 block discarded – undo
870 879
 			{
871 880
 				foreach($this->_sideBarDataList->getItems() as $item)
872 881
 				{
873
-					if(($button=$item->findControl('SideBarButton'))!==null)
874
-						$button->getStyle()->mergeWith($style);
882
+					if(($button=$item->findControl('SideBarButton'))!==null) {
883
+											$button->getStyle()->mergeWith($style);
884
+					}
875 885
 				}
876 886
 			}
877 887
 		}
878
-		if(($style=$this->getViewState('SideBarStyle',null))!==null)
879
-			$this->_sideBar->getStyle()->mergeWith($style);
888
+		if(($style=$this->getViewState('SideBarStyle',null))!==null) {
889
+					$this->_sideBar->getStyle()->mergeWith($style);
890
+		}
880 891
 	}
881 892
 
882 893
 	/**
@@ -884,8 +895,9 @@  discard block
 block discarded – undo
884 895
 	 */
885 896
 	protected function applyStepContentProperties()
886 897
 	{
887
-		if(($style=$this->getViewState('StepStyle',null))!==null)
888
-			$this->_stepContent->getStyle()->mergeWith($style);
898
+		if(($style=$this->getViewState('StepStyle',null))!==null) {
899
+					$this->_stepContent->getStyle()->mergeWith($style);
900
+		}
889 901
 	}
890 902
 
891 903
 	/**
@@ -897,9 +909,9 @@  discard block
 block discarded – undo
897 909
 		$activeStep=$this->getActiveStep();
898 910
 		$activeStepIndex=$this->getActiveStepIndex();
899 911
 
900
-		if(!$this->_navigation)
901
-			return;
902
-		else if($activeStepIndex<0 || $activeStepIndex>=$wizardSteps->getCount())
912
+		if(!$this->_navigation) {
913
+					return;
914
+		} else if($activeStepIndex<0 || $activeStepIndex>=$wizardSteps->getCount())
903 915
 		{
904 916
 			$this->_navigation->setVisible(false);
905 917
 			return;
@@ -915,9 +927,9 @@  discard block
 block discarded – undo
915 927
 				{
916 928
 					$container->setVisible(true);
917 929
 					$showStandard=false;
930
+				} else {
931
+									$container->setVisible(false);
918 932
 				}
919
-				else
920
-					$container->setVisible(false);
921 933
 			}
922 934
 		}
923 935
 		$activeStepType=$this->getStepType($activeStep);
@@ -930,14 +942,16 @@  discard block
 block discarded – undo
930 942
 		$this->_stepNavigation->setVisible($showStandard && $activeStepType===self::ST_STEP);
931 943
 		$this->_finishNavigation->setVisible($showStandard && $activeStepType===self::ST_FINISH);
932 944
 
933
-		if(($navigationStyle=$this->getViewState('NavigationStyle',null))!==null)
934
-			$this->_navigation->getStyle()->mergeWith($navigationStyle);
945
+		if(($navigationStyle=$this->getViewState('NavigationStyle',null))!==null) {
946
+					$this->_navigation->getStyle()->mergeWith($navigationStyle);
947
+		}
935 948
 
936 949
 		$displayCancelButton=$this->getShowCancelButton();
937 950
 		$cancelButtonStyle=$this->getCancelButtonStyle();
938 951
 		$buttonStyle=$this->getViewState('NavigationButtonStyle',null);
939
-		if($buttonStyle!==null)
940
-			$cancelButtonStyle->mergeWith($buttonStyle);
952
+		if($buttonStyle!==null) {
953
+					$cancelButtonStyle->mergeWith($buttonStyle);
954
+		}
941 955
 
942 956
 		// apply styles to start navigation buttons
943 957
 		if(($cancelButton=$this->_startNavigation->getCancelButton())!==null)
@@ -949,11 +963,13 @@  discard block
 block discarded – undo
949 963
 		{
950 964
 			$button->setVisible(true);
951 965
 			$style=$this->getStartNextButtonStyle();
952
-			if($buttonStyle!==null)
953
-				$style->mergeWith($buttonStyle);
966
+			if($buttonStyle!==null) {
967
+							$style->mergeWith($buttonStyle);
968
+			}
954 969
 			$style->apply($button);
955
-			if($activeStepType===TWizardStepType::Start)
956
-				$this->getPage()->getClientScript()->registerDefaultButton($this, $button);
970
+			if($activeStepType===TWizardStepType::Start) {
971
+							$this->getPage()->getClientScript()->registerDefaultButton($this, $button);
972
+			}
957 973
 		}
958 974
 
959 975
 		// apply styles to finish navigation buttons
@@ -966,19 +982,22 @@  discard block
 block discarded – undo
966 982
 		{
967 983
 			$button->setVisible($this->allowNavigationToPreviousStep());
968 984
 			$style=$this->getFinishPreviousButtonStyle();
969
-			if($buttonStyle!==null)
970
-				$style->mergeWith($buttonStyle);
985
+			if($buttonStyle!==null) {
986
+							$style->mergeWith($buttonStyle);
987
+			}
971 988
 			$style->apply($button);
972 989
 		}
973 990
 		if(($button=$this->_finishNavigation->getCompleteButton())!==null)
974 991
 		{
975 992
 			$button->setVisible(true);
976 993
 			$style=$this->getFinishCompleteButtonStyle();
977
-			if($buttonStyle!==null)
978
-				$style->mergeWith($buttonStyle);
994
+			if($buttonStyle!==null) {
995
+							$style->mergeWith($buttonStyle);
996
+			}
979 997
 			$style->apply($button);
980
-			if($activeStepType===TWizardStepType::Finish)
981
-				$this->getPage()->getClientScript()->registerDefaultButton($this, $button);
998
+			if($activeStepType===TWizardStepType::Finish) {
999
+							$this->getPage()->getClientScript()->registerDefaultButton($this, $button);
1000
+			}
982 1001
 		}
983 1002
 
984 1003
 		// apply styles to step navigation buttons
@@ -991,19 +1010,22 @@  discard block
 block discarded – undo
991 1010
 		{
992 1011
 			$button->setVisible($this->allowNavigationToPreviousStep());
993 1012
 			$style=$this->getStepPreviousButtonStyle();
994
-			if($buttonStyle!==null)
995
-				$style->mergeWith($buttonStyle);
1013
+			if($buttonStyle!==null) {
1014
+							$style->mergeWith($buttonStyle);
1015
+			}
996 1016
 			$style->apply($button);
997 1017
 		}
998 1018
 		if(($button=$this->_stepNavigation->getNextButton())!==null)
999 1019
 		{
1000 1020
 			$button->setVisible(true);
1001 1021
 			$style=$this->getStepNextButtonStyle();
1002
-			if($buttonStyle!==null)
1003
-				$style->mergeWith($buttonStyle);
1022
+			if($buttonStyle!==null) {
1023
+							$style->mergeWith($buttonStyle);
1024
+			}
1004 1025
 			$style->apply($button);
1005
-			if($activeStepType===TWizardStepType::Step)
1006
-				$this->getPage()->getClientScript()->registerDefaultButton($this, $button);
1026
+			if($activeStepType===TWizardStepType::Step) {
1027
+							$this->getPage()->getClientScript()->registerDefaultButton($this, $button);
1028
+			}
1007 1029
 		}
1008 1030
 	}
1009 1031
 
@@ -1033,20 +1055,21 @@  discard block
 block discarded – undo
1033 1055
 			if(($index=$steps->indexOf($wizardStep))>=0)
1034 1056
 			{
1035 1057
 				$stepCount=$steps->getCount();
1036
-				if($stepCount===1 || ($index<$stepCount-1 && $steps->itemAt($index+1)->getStepType()===TWizardStepType::Complete))
1037
-					return TWizardStepType::Finish;
1038
-				else if($index===0)
1039
-					return TWizardStepType::Start;
1040
-				else if($index===$stepCount-1)
1041
-					return TWizardStepType::Finish;
1042
-				else
1043
-					return TWizardStepType::Step;
1058
+				if($stepCount===1 || ($index<$stepCount-1 && $steps->itemAt($index+1)->getStepType()===TWizardStepType::Complete)) {
1059
+									return TWizardStepType::Finish;
1060
+				} else if($index===0) {
1061
+									return TWizardStepType::Start;
1062
+				} else if($index===$stepCount-1) {
1063
+									return TWizardStepType::Finish;
1064
+				} else {
1065
+									return TWizardStepType::Step;
1066
+				}
1067
+			} else {
1068
+							return $type;
1044 1069
 			}
1045
-			else
1046
-				return $type;
1070
+		} else {
1071
+					return $type;
1047 1072
 		}
1048
-		else
1049
-			return $type;
1050 1073
 	}
1051 1074
 
1052 1075
 	/**
@@ -1084,10 +1107,11 @@  discard block
 block discarded – undo
1084 1107
 	protected function createHeader()
1085 1108
 	{
1086 1109
 		$this->_header=new TPanel;
1087
-		if(($template=$this->getHeaderTemplate())!==null)
1088
-			$template->instantiateIn($this->_header);
1089
-		else
1090
-			$this->_header->getControls()->add($this->getHeaderText());
1110
+		if(($template=$this->getHeaderTemplate())!==null) {
1111
+					$template->instantiateIn($this->_header);
1112
+		} else {
1113
+					$this->_header->getControls()->add($this->getHeaderText());
1114
+		}
1091 1115
 		$this->getControls()->add($this->_header);
1092 1116
 	}
1093 1117
 
@@ -1098,8 +1122,9 @@  discard block
 block discarded – undo
1098 1122
 	{
1099 1123
 		if($this->getShowSideBar())
1100 1124
 		{
1101
-			if(($template=$this->getSideBarTemplate())===null)
1102
-				$template=new TWizardSideBarTemplate;
1125
+			if(($template=$this->getSideBarTemplate())===null) {
1126
+							$template=new TWizardSideBarTemplate;
1127
+			}
1103 1128
 			$this->_sideBar=new TPanel;
1104 1129
 			$template->instantiateIn($this->_sideBar);
1105 1130
 			$this->getControls()->add($this->_sideBar);
@@ -1112,8 +1137,7 @@  discard block
 block discarded – undo
1112 1137
 				$this->_sideBarDataList->setSelectedItemIndex($this->getActiveStepIndex());
1113 1138
 				$this->_sideBarDataList->dataBind();
1114 1139
 			}
1115
-		}
1116
-		else
1140
+		} else
1117 1141
 		{
1118 1142
 			$this->_sideBar=new TPanel;
1119 1143
 			$this->getControls()->add($this->_sideBar);
@@ -1140,19 +1164,21 @@  discard block
 block discarded – undo
1140 1164
 			// if the button clicked causes validation which fails,
1141 1165
 			// by default we will cancel navigation to the new step
1142 1166
 			$button=$param->getCommandSource();
1143
-			if(($button instanceof IButtonControl) && $button->getCausesValidation() && ($page=$this->getPage())!==null && !$page->getIsValid())
1144
-				$navParam->setCancelNavigation(true);
1167
+			if(($button instanceof IButtonControl) && $button->getCausesValidation() && ($page=$this->getPage())!==null && !$page->getIsValid()) {
1168
+							$navParam->setCancelNavigation(true);
1169
+			}
1145 1170
 
1146 1171
 			$this->_activeStepIndexSet=false;
1147 1172
 			$this->onSideBarButtonClick($navParam);
1148 1173
 			$this->_cancelNavigation=$navParam->getCancelNavigation();
1149 1174
 			if(!$this->_cancelNavigation)
1150 1175
 			{
1151
-				if(!$this->_activeStepIndexSet && $this->allowNavigationToStep($newStepIndex))
1152
-					$this->setActiveStepIndex($newStepIndex);
1176
+				if(!$this->_activeStepIndexSet && $this->allowNavigationToStep($newStepIndex)) {
1177
+									$this->setActiveStepIndex($newStepIndex);
1178
+				}
1179
+			} else {
1180
+							$this->setActiveStepIndex($stepIndex);
1153 1181
 			}
1154
-			else
1155
-				$this->setActiveStepIndex($stepIndex);
1156 1182
 		}
1157 1183
 	}
1158 1184
 
@@ -1172,12 +1198,14 @@  discard block
 block discarded – undo
1172 1198
 			if(($button=$item->findControl(self::ID_SIDEBAR_BUTTON))!==null)
1173 1199
 			{
1174 1200
 				$step=$item->getData();
1175
-				if(($this->getStepType($step)===TWizardStepType::Complete))
1176
-					$button->setEnabled(false);
1177
-				if(($title=$step->getTitle())!=='')
1178
-					$button->setText($title);
1179
-				else
1180
-					$button->setText($step->getID(false));
1201
+				if(($this->getStepType($step)===TWizardStepType::Complete)) {
1202
+									$button->setEnabled(false);
1203
+				}
1204
+				if(($title=$step->getTitle())!=='') {
1205
+									$button->setText($title);
1206
+				} else {
1207
+									$button->setText($step->getID(false));
1208
+				}
1181 1209
 				$index=$this->getWizardSteps()->indexOf($step);
1182 1210
 				$button->setCommandName(self::CMD_MOVETO);
1183 1211
 				$button->setCommandParameter("$index");
@@ -1192,15 +1220,17 @@  discard block
 block discarded – undo
1192 1220
 	{
1193 1221
 		foreach($this->getWizardSteps() as $step)
1194 1222
 		{
1195
-			if($step instanceof TTemplatedWizardStep)
1196
-				$step->ensureChildControls();
1223
+			if($step instanceof TTemplatedWizardStep) {
1224
+							$step->ensureChildControls();
1225
+			}
1197 1226
 		}
1198 1227
 		$multiView=$this->getMultiView();
1199 1228
 		$this->_stepContent=new TPanel;
1200 1229
 		$this->_stepContent->getControls()->add($multiView);
1201 1230
 		$this->getControls()->add($this->_stepContent);
1202
-		if($multiView->getViews()->getCount())
1203
-			$multiView->setActiveViewIndex(0);
1231
+		if($multiView->getViews()->getCount()) {
1232
+					$multiView->setActiveViewIndex(0);
1233
+		}
1204 1234
 	}
1205 1235
 
1206 1236
 	/**
@@ -1216,8 +1246,9 @@  discard block
 block discarded – undo
1216 1246
 			if($step instanceof TTemplatedWizardStep)
1217 1247
 			{
1218 1248
 				$step->instantiateNavigationTemplate();
1219
-				if(($panel=$step->getNavigationContainer())!==null)
1220
-					$controls->add($panel);
1249
+				if(($panel=$step->getNavigationContainer())!==null) {
1250
+									$controls->add($panel);
1251
+				}
1221 1252
 			}
1222 1253
 		}
1223 1254
 		$this->_startNavigation=$this->createStartNavigation();
@@ -1233,8 +1264,9 @@  discard block
 block discarded – undo
1233 1264
 	 */
1234 1265
 	protected function createStartNavigation()
1235 1266
 	{
1236
-		if(($template=$this->getStartNavigationTemplate())===null)
1237
-			$template=new TWizardStartNavigationTemplate($this);
1267
+		if(($template=$this->getStartNavigationTemplate())===null) {
1268
+					$template=new TWizardStartNavigationTemplate($this);
1269
+		}
1238 1270
 		$navigation=new TWizardNavigationContainer;
1239 1271
 		$template->instantiateIn($navigation);
1240 1272
 		return $navigation;
@@ -1245,8 +1277,9 @@  discard block
 block discarded – undo
1245 1277
 	 */
1246 1278
 	protected function createStepNavigation()
1247 1279
 	{
1248
-		if(($template=$this->getStepNavigationTemplate())===null)
1249
-			$template=new TWizardStepNavigationTemplate($this);
1280
+		if(($template=$this->getStepNavigationTemplate())===null) {
1281
+					$template=new TWizardStepNavigationTemplate($this);
1282
+		}
1250 1283
 		$navigation=new TWizardNavigationContainer;
1251 1284
 		$template->instantiateIn($navigation);
1252 1285
 		return $navigation;
@@ -1257,8 +1290,9 @@  discard block
 block discarded – undo
1257 1290
 	 */
1258 1291
 	protected function createFinishNavigation()
1259 1292
 	{
1260
-		if(($template=$this->getFinishNavigationTemplate())===null)
1261
-			$template=new TWizardFinishNavigationTemplate($this);
1293
+		if(($template=$this->getFinishNavigationTemplate())===null) {
1294
+					$template=new TWizardFinishNavigationTemplate($this);
1295
+		}
1262 1296
 		$navigation=new TWizardNavigationContainer;
1263 1297
 		$template->instantiateIn($navigation);
1264 1298
 		return $navigation;
@@ -1293,10 +1327,10 @@  discard block
 block discarded – undo
1293 1327
 			if($popStack)
1294 1328
 			{
1295 1329
 				$previousStepIndex=$history->pop();
1296
-				if($activeStepIndex===$previousStepIndex && $history->getCount()>0)
1297
-					$previousStepIndex=$history->pop();
1298
-			}
1299
-			else
1330
+				if($activeStepIndex===$previousStepIndex && $history->getCount()>0) {
1331
+									$previousStepIndex=$history->pop();
1332
+				}
1333
+			} else
1300 1334
 			{
1301 1335
 				$previousStepIndex=$history->peek();
1302 1336
 				if($activeStepIndex===$previousStepIndex && $history->getCount()>1)
@@ -1307,9 +1341,9 @@  discard block
 block discarded – undo
1307 1341
 				}
1308 1342
 			}
1309 1343
 			return $activeStepIndex===$previousStepIndex ? -1 : $previousStepIndex;
1344
+		} else {
1345
+					return -1;
1310 1346
 		}
1311
-		else
1312
-			return -1;
1313 1347
 	}
1314 1348
 
1315 1349
 	/**
@@ -1317,10 +1351,11 @@  discard block
 block discarded – undo
1317 1351
 	 */
1318 1352
 	protected function allowNavigationToPreviousStep()
1319 1353
 	{
1320
-		if(($index=$this->getPreviousStepIndex(false))!==-1)
1321
-			return $this->getWizardSteps()->itemAt($index)->getAllowReturn();
1322
-		else
1323
-			return false;
1354
+		if(($index=$this->getPreviousStepIndex(false))!==-1) {
1355
+					return $this->getWizardSteps()->itemAt($index)->getAllowReturn();
1356
+		} else {
1357
+					return false;
1358
+		}
1324 1359
 	}
1325 1360
 
1326 1361
 	/**
@@ -1329,10 +1364,11 @@  discard block
 block discarded – undo
1329 1364
 	 */
1330 1365
 	protected function allowNavigationToStep($index)
1331 1366
 	{
1332
-		if($this->getHistory()->contains($index))
1333
-			return $this->getWizardSteps()->itemAt($index)->getAllowReturn();
1334
-		else
1335
-			return true;
1367
+		if($this->getHistory()->contains($index)) {
1368
+					return $this->getWizardSteps()->itemAt($index)->getAllowReturn();
1369
+		} else {
1370
+					return true;
1371
+		}
1336 1372
 	}
1337 1373
 
1338 1374
 	/**
@@ -1357,8 +1393,9 @@  discard block
 block discarded – undo
1357 1393
 			$type=$this->getStepType($this->getActiveStep());
1358 1394
 			$index=$this->getActiveStepIndex();
1359 1395
 			$navParam=new TWizardNavigationEventParameter($index);
1360
-			if(($sender instanceof IButtonControl) && $sender->getCausesValidation() && ($page=$this->getPage())!==null && !$page->getIsValid())
1361
-				$navParam->setCancelNavigation(true);
1396
+			if(($sender instanceof IButtonControl) && $sender->getCausesValidation() && ($page=$this->getPage())!==null && !$page->getIsValid()) {
1397
+							$navParam->setCancelNavigation(true);
1398
+			}
1362 1399
 
1363 1400
 			$handled=false;
1364 1401
 			$movePrev=false;
@@ -1366,51 +1403,58 @@  discard block
 block discarded – undo
1366 1403
 
1367 1404
 			if(strcasecmp($command,self::CMD_NEXT)===0)
1368 1405
 			{
1369
-				if($type!==self::ST_START && $type!==self::ST_STEP)
1370
-					throw new TInvalidDataValueException('wizard_command_invalid',self::CMD_NEXT);
1371
-				if($index<$this->getWizardSteps()->getCount()-1)
1372
-					$navParam->setNextStepIndex($index+1);
1406
+				if($type!==self::ST_START && $type!==self::ST_STEP) {
1407
+									throw new TInvalidDataValueException('wizard_command_invalid',self::CMD_NEXT);
1408
+				}
1409
+				if($index<$this->getWizardSteps()->getCount()-1) {
1410
+									$navParam->setNextStepIndex($index+1);
1411
+				}
1373 1412
 				$this->onNextButtonClick($navParam);
1374 1413
 				$handled=true;
1375
-			}
1376
-			else if(strcasecmp($command,self::CMD_PREVIOUS)===0)
1414
+			} else if(strcasecmp($command,self::CMD_PREVIOUS)===0)
1377 1415
 			{
1378
-				if($type!==self::ST_FINISH && $type!==self::ST_STEP)
1379
-					throw new TInvalidDataValueException('wizard_command_invalid',self::CMD_PREVIOUS);
1416
+				if($type!==self::ST_FINISH && $type!==self::ST_STEP) {
1417
+									throw new TInvalidDataValueException('wizard_command_invalid',self::CMD_PREVIOUS);
1418
+				}
1380 1419
 				$movePrev=true;
1381
-				if(($prevIndex=$this->getPreviousStepIndex(false))>=0)
1382
-					$navParam->setNextStepIndex($prevIndex);
1420
+				if(($prevIndex=$this->getPreviousStepIndex(false))>=0) {
1421
+									$navParam->setNextStepIndex($prevIndex);
1422
+				}
1383 1423
 				$this->onPreviousButtonClick($navParam);
1384 1424
 				$handled=true;
1385
-			}
1386
-			else if(strcasecmp($command,self::CMD_COMPLETE)===0)
1425
+			} else if(strcasecmp($command,self::CMD_COMPLETE)===0)
1387 1426
 			{
1388
-				if($type!==self::ST_FINISH)
1389
-					throw new TInvalidDataValueException('wizard_command_invalid',self::CMD_COMPLETE);
1390
-				if($index<$this->getWizardSteps()->getCount()-1)
1391
-					$navParam->setNextStepIndex($index+1);
1427
+				if($type!==self::ST_FINISH) {
1428
+									throw new TInvalidDataValueException('wizard_command_invalid',self::CMD_COMPLETE);
1429
+				}
1430
+				if($index<$this->getWizardSteps()->getCount()-1) {
1431
+									$navParam->setNextStepIndex($index+1);
1432
+				}
1392 1433
 				$this->onCompleteButtonClick($navParam);
1393 1434
 				$handled=true;
1394
-			}
1395
-			else if(strcasecmp($command,self::CMD_MOVETO)===0)
1435
+			} else if(strcasecmp($command,self::CMD_MOVETO)===0)
1396 1436
 			{
1397
-				if($this->_cancelNavigation)  // may be set in onSideBarButtonClick
1437
+				if($this->_cancelNavigation) {
1438
+					// may be set in onSideBarButtonClick
1398 1439
 					$navParam->setCancelNavigation(true);
1440
+				}
1399 1441
 				$requestedStep=$param->getCommandParameter();
1400 1442
 				if (!is_numeric($requestedStep))
1401 1443
 				{
1402 1444
 					$requestedIndex=-1;
1403
-					foreach ($this->getWizardSteps() as $index=>$step)
1404
-						if ($step->getId()===$requestedStep)
1445
+					foreach ($this->getWizardSteps() as $index=>$step) {
1446
+											if ($step->getId()===$requestedStep)
1405 1447
 						{
1406 1448
 							$requestedIndex=$index;
1449
+					}
1407 1450
 							break;
1408 1451
 						}
1409
-					if ($requestedIndex<0)
1410
-						throw new TConfigurationException('wizard_step_invalid');
1452
+					if ($requestedIndex<0) {
1453
+											throw new TConfigurationException('wizard_step_invalid');
1454
+					}
1455
+				} else {
1456
+									$requestedIndex=TPropertyValue::ensureInteger($requestedStep);
1411 1457
 				}
1412
-				else
1413
-					$requestedIndex=TPropertyValue::ensureInteger($requestedStep);
1414 1458
 				$navParam->setNextStepIndex($requestedIndex);
1415 1459
 				$handled=true;
1416 1460
 			}
@@ -1422,13 +1466,15 @@  discard block
 block discarded – undo
1422 1466
 					$nextStepIndex=$navParam->getNextStepIndex();
1423 1467
 					if(!$this->_activeStepIndexSet && $this->allowNavigationToStep($nextStepIndex))
1424 1468
 					{
1425
-						if($movePrev)
1426
-							$this->getPreviousStepIndex(true);  // pop out the previous move from history
1469
+						if($movePrev) {
1470
+													$this->getPreviousStepIndex(true);
1471
+						}
1472
+						// pop out the previous move from history
1427 1473
 						$this->setActiveStepIndex($nextStepIndex);
1428 1474
 					}
1475
+				} else {
1476
+									$this->setActiveStepIndex($index);
1429 1477
 				}
1430
-				else
1431
-					$this->setActiveStepIndex($index);
1432 1478
 				return true;
1433 1479
 			}
1434 1480
 		}
@@ -1486,8 +1532,9 @@  discard block
 block discarded – undo
1486 1532
 	public function setTitle($value)
1487 1533
 	{
1488 1534
 		$this->setViewState('Title',$value,'');
1489
-		if($this->_wizard)
1490
-			$this->_wizard->wizardStepsChanged();
1535
+		if($this->_wizard) {
1536
+					$this->_wizard->wizardStepsChanged();
1537
+		}
1491 1538
 	}
1492 1539
 
1493 1540
 	/**
@@ -1523,8 +1570,9 @@  discard block
 block discarded – undo
1523 1570
 		if($type!==$this->getStepType())
1524 1571
 		{
1525 1572
 			$this->setViewState('StepType',$type,TWizardStepType::Auto);
1526
-			if($this->_wizard)
1527
-				$this->_wizard->wizardStepsChanged();
1573
+			if($this->_wizard) {
1574
+							$this->_wizard->wizardStepsChanged();
1575
+			}
1528 1576
 		}
1529 1577
 	}
1530 1578
 }
@@ -1595,8 +1643,9 @@  discard block
 block discarded – undo
1595 1643
 	public function createChildControls()
1596 1644
 	{
1597 1645
 		$this->getControls()->clear();
1598
-		if($this->_contentTemplate)
1599
-			$this->_contentTemplate->instantiateIn($this);
1646
+		if($this->_contentTemplate) {
1647
+					$this->_contentTemplate->instantiateIn($this);
1648
+		}
1600 1649
 	}
1601 1650
 
1602 1651
 	/**
@@ -1705,9 +1754,9 @@  discard block
 block discarded – undo
1705 1754
 			parent::insertAt($index,$item);
1706 1755
 			$this->_wizard->getMultiView()->getViews()->insertAt($index,$item);
1707 1756
 			$this->_wizard->addedWizardStep($item);
1757
+		} else {
1758
+					throw new TInvalidDataTypeException('wizardstepcollection_wizardstep_required');
1708 1759
 		}
1709
-		else
1710
-			throw new TInvalidDataTypeException('wizardstepcollection_wizardstep_required');
1711 1760
 	}
1712 1761
 
1713 1762
 	/**
Please login to merge, or discard this patch.
framework/Web/UI/WebControls/TWizardNavigationButtonStyle.php 3 patches
Doc Comments   +1 added lines patch added patch discarded remove patch
@@ -113,6 +113,7 @@
 block discarded – undo
113 113
 
114 114
 	/**
115 115
 	 * @param string button caption
116
+	 * @param string $value
116 117
 	 */
117 118
 	public function setButtonText($value)
118 119
 	{
Please login to merge, or discard this patch.
Spacing   +29 added lines, -29 removed lines patch added patch discarded remove patch
@@ -30,9 +30,9 @@  discard block
 block discarded – undo
30 30
  */
31 31
 class TWizardNavigationButtonStyle extends TStyle
32 32
 {
33
-	private $_imageUrl=null;
34
-	private $_buttonText=null;
35
-	private $_buttonType=null;
33
+	private $_imageUrl = null;
34
+	private $_buttonText = null;
35
+	private $_buttonType = null;
36 36
 
37 37
 	/**
38 38
 	 * Sets the style attributes to default values.
@@ -42,9 +42,9 @@  discard block
 block discarded – undo
42 42
 	public function reset()
43 43
 	{
44 44
 		parent::reset();
45
-		$this->_imageUrl=null;
46
-		$this->_buttonText=null;
47
-		$this->_buttonType=null;
45
+		$this->_imageUrl = null;
46
+		$this->_buttonText = null;
47
+		$this->_buttonType = null;
48 48
 	}
49 49
 
50 50
 	/**
@@ -56,14 +56,14 @@  discard block
 block discarded – undo
56 56
 	public function copyFrom($style)
57 57
 	{
58 58
 		parent::copyFrom($style);
59
-		if($style instanceof TWizardNavigationButtonStyle)
59
+		if ($style instanceof TWizardNavigationButtonStyle)
60 60
 		{
61
-			if($this->_imageUrl===null && $style->_imageUrl!==null)
62
-				$this->_imageUrl=$style->_imageUrl;
63
-			if($this->_buttonText===null && $style->_buttonText!==null)
64
-				$this->_buttonText=$style->_buttonText;
65
-			if($this->_buttonType===null && $style->_buttonType!==null)
66
-				$this->_buttonType=$style->_buttonType;
61
+			if ($this->_imageUrl === null && $style->_imageUrl !== null)
62
+				$this->_imageUrl = $style->_imageUrl;
63
+			if ($this->_buttonText === null && $style->_buttonText !== null)
64
+				$this->_buttonText = $style->_buttonText;
65
+			if ($this->_buttonType === null && $style->_buttonType !== null)
66
+				$this->_buttonType = $style->_buttonType;
67 67
 		}
68 68
 	}
69 69
 
@@ -76,14 +76,14 @@  discard block
 block discarded – undo
76 76
 	public function mergeWith($style)
77 77
 	{
78 78
 		parent::mergeWith($style);
79
-		if($style instanceof TWizardNavigationButtonStyle)
79
+		if ($style instanceof TWizardNavigationButtonStyle)
80 80
 		{
81
-			if($style->_imageUrl!==null)
82
-				$this->_imageUrl=$style->_imageUrl;
83
-			if($style->_buttonText!==null)
84
-				$this->_buttonText=$style->_buttonText;
85
-			if($style->_buttonType!==null)
86
-				$this->_buttonType=$style->_buttonType;
81
+			if ($style->_imageUrl !== null)
82
+				$this->_imageUrl = $style->_imageUrl;
83
+			if ($style->_buttonText !== null)
84
+				$this->_buttonText = $style->_buttonText;
85
+			if ($style->_buttonType !== null)
86
+				$this->_buttonType = $style->_buttonType;
87 87
 		}
88 88
 	}
89 89
 
@@ -92,7 +92,7 @@  discard block
 block discarded – undo
92 92
 	 */
93 93
 	public function getImageUrl()
94 94
 	{
95
-		return $this->_imageUrl===null?'':$this->_imageUrl;
95
+		return $this->_imageUrl === null ? '' : $this->_imageUrl;
96 96
 	}
97 97
 
98 98
 	/**
@@ -100,7 +100,7 @@  discard block
 block discarded – undo
100 100
 	 */
101 101
 	public function setImageUrl($value)
102 102
 	{
103
-		$this->_imageUrl=$value;
103
+		$this->_imageUrl = $value;
104 104
 	}
105 105
 
106 106
 	/**
@@ -108,7 +108,7 @@  discard block
 block discarded – undo
108 108
 	 */
109 109
 	public function getButtonText()
110 110
 	{
111
-		return $this->_buttonText===null?'':$this->_buttonText;
111
+		return $this->_buttonText === null ? '' : $this->_buttonText;
112 112
 	}
113 113
 
114 114
 	/**
@@ -116,7 +116,7 @@  discard block
 block discarded – undo
116 116
 	 */
117 117
 	public function setButtonText($value)
118 118
 	{
119
-		$this->_buttonText=$value;
119
+		$this->_buttonText = $value;
120 120
 	}
121 121
 
122 122
 	/**
@@ -124,7 +124,7 @@  discard block
 block discarded – undo
124 124
 	 */
125 125
 	public function getButtonType()
126 126
 	{
127
-		return $this->_buttonType===null? TWizardNavigationButtonType::Button :$this->_buttonType;
127
+		return $this->_buttonType === null ? TWizardNavigationButtonType::Button : $this->_buttonType;
128 128
 	}
129 129
 
130 130
 	/**
@@ -132,7 +132,7 @@  discard block
 block discarded – undo
132 132
 	 */
133 133
 	public function setButtonType($value)
134 134
 	{
135
-		$this->_buttonType=TPropertyValue::ensureEnum($value,'TWizardNavigationButtonType');
135
+		$this->_buttonType = TPropertyValue::ensureEnum($value, 'TWizardNavigationButtonType');
136 136
 	}
137 137
 
138 138
 	/**
@@ -141,12 +141,12 @@  discard block
 block discarded – undo
141 141
 	 */
142 142
 	public function apply($button)
143 143
 	{
144
-		if($button instanceof TImageButton)
144
+		if ($button instanceof TImageButton)
145 145
 		{
146
-			if($button->getImageUrl()==='')
146
+			if ($button->getImageUrl() === '')
147 147
 				$button->setImageUrl($this->getImageUrl());
148 148
 		}
149
-		if($button->getText()==='')
149
+		if ($button->getText() === '')
150 150
 			$button->setText($this->getButtonText());
151 151
 		$button->getStyle()->mergeWith($this);
152 152
 	}
Please login to merge, or discard this patch.
Braces   +24 added lines, -16 removed lines patch added patch discarded remove patch
@@ -58,12 +58,15 @@  discard block
 block discarded – undo
58 58
 		parent::copyFrom($style);
59 59
 		if($style instanceof TWizardNavigationButtonStyle)
60 60
 		{
61
-			if($this->_imageUrl===null && $style->_imageUrl!==null)
62
-				$this->_imageUrl=$style->_imageUrl;
63
-			if($this->_buttonText===null && $style->_buttonText!==null)
64
-				$this->_buttonText=$style->_buttonText;
65
-			if($this->_buttonType===null && $style->_buttonType!==null)
66
-				$this->_buttonType=$style->_buttonType;
61
+			if($this->_imageUrl===null && $style->_imageUrl!==null) {
62
+							$this->_imageUrl=$style->_imageUrl;
63
+			}
64
+			if($this->_buttonText===null && $style->_buttonText!==null) {
65
+							$this->_buttonText=$style->_buttonText;
66
+			}
67
+			if($this->_buttonType===null && $style->_buttonType!==null) {
68
+							$this->_buttonType=$style->_buttonType;
69
+			}
67 70
 		}
68 71
 	}
69 72
 
@@ -78,12 +81,15 @@  discard block
 block discarded – undo
78 81
 		parent::mergeWith($style);
79 82
 		if($style instanceof TWizardNavigationButtonStyle)
80 83
 		{
81
-			if($style->_imageUrl!==null)
82
-				$this->_imageUrl=$style->_imageUrl;
83
-			if($style->_buttonText!==null)
84
-				$this->_buttonText=$style->_buttonText;
85
-			if($style->_buttonType!==null)
86
-				$this->_buttonType=$style->_buttonType;
84
+			if($style->_imageUrl!==null) {
85
+							$this->_imageUrl=$style->_imageUrl;
86
+			}
87
+			if($style->_buttonText!==null) {
88
+							$this->_buttonText=$style->_buttonText;
89
+			}
90
+			if($style->_buttonType!==null) {
91
+							$this->_buttonType=$style->_buttonType;
92
+			}
87 93
 		}
88 94
 	}
89 95
 
@@ -143,11 +149,13 @@  discard block
 block discarded – undo
143 149
 	{
144 150
 		if($button instanceof TImageButton)
145 151
 		{
146
-			if($button->getImageUrl()==='')
147
-				$button->setImageUrl($this->getImageUrl());
152
+			if($button->getImageUrl()==='') {
153
+							$button->setImageUrl($this->getImageUrl());
154
+			}
155
+		}
156
+		if($button->getText()==='') {
157
+					$button->setText($this->getButtonText());
148 158
 		}
149
-		if($button->getText()==='')
150
-			$button->setText($this->getButtonText());
151 159
 		$button->getStyle()->mergeWith($this);
152 160
 	}
153 161
 }
Please login to merge, or discard this patch.
framework/Web/UI/WebControls/TXmlTransform.php 3 patches
Doc Comments   +3 added lines patch added patch discarded remove patch
@@ -60,6 +60,7 @@  discard block
 block discarded – undo
60 60
 
61 61
   /**
62 62
    * @param string The path to the XML style sheet.  It must be in namespace format.
63
+   * @param string $value
63 64
    */
64 65
   public function setTransformPath($value) {
65 66
     if(!is_file($value)) {
@@ -94,6 +95,7 @@  discard block
 block discarded – undo
94 95
 
95 96
   /**
96 97
    * @param string Namespace or path to XML document
98
+   * @param string $value
97 99
    * @throws TInvalidDataValueException
98 100
    */
99 101
   public function setDocumentPath($value) {
@@ -165,6 +167,7 @@  discard block
 block discarded – undo
165 167
   /**
166 168
    * Performs XSL transformation and render the output.
167 169
    * @param THtmlWriter The writer used for the rendering purpose
170
+   * @param THtmlWriter $writer
168 171
    */
169 172
   public function render($writer) {
170 173
     if(($document=$this->getSourceXmlDocument()) === null) {
Please login to merge, or discard this patch.
Indentation   +69 added lines, -69 removed lines patch added patch discarded remove patch
@@ -46,50 +46,50 @@  discard block
 block discarded – undo
46 46
    * @throws TConfigurationException If XSL extension is not available
47 47
    */
48 48
   public function __construct() {
49
-    if(!class_exists('XSLTProcessor', false)) {
50
-      throw new TConfigurationException('xmltransform_xslextension_required');
51
-    }
49
+	if(!class_exists('XSLTProcessor', false)) {
50
+	  throw new TConfigurationException('xmltransform_xslextension_required');
51
+	}
52 52
   }
53 53
 
54 54
   /**
55 55
    * @return string The path to the XML style sheet.
56 56
    */
57 57
   public function getTransformPath() {
58
-    return $this->getViewState('TransformPath', '');
58
+	return $this->getViewState('TransformPath', '');
59 59
   }
60 60
 
61 61
   /**
62 62
    * @param string The path to the XML style sheet.  It must be in namespace format.
63 63
    */
64 64
   public function setTransformPath($value) {
65
-    if(!is_file($value)) {
66
-      $value = Prado::getPathOfNamespace($value, self::EXT_XSL_FILE);
67
-      if($value === null) {
65
+	if(!is_file($value)) {
66
+	  $value = Prado::getPathOfNamespace($value, self::EXT_XSL_FILE);
67
+	  if($value === null) {
68 68
 	throw new TInvalidDataValueException('xmltransform_transformpath_invalid', $value);
69
-      }
70
-    }
71
-    $this->setViewState('TransformPath', $value, '');
69
+	  }
70
+	}
71
+	$this->setViewState('TransformPath', $value, '');
72 72
   }
73 73
 
74 74
   /**
75 75
    * @return string XML style sheet as string
76 76
    */
77 77
   public function getTransformContent() {
78
-    return $this->getViewState('TransformContent', '');
78
+	return $this->getViewState('TransformContent', '');
79 79
   }
80 80
 
81 81
   /**
82 82
    * @param string $value XML style sheet as string
83 83
    */
84 84
   public function setTransformContent($value) {
85
-    $this->setViewState('TransformContent', $value, '');
85
+	$this->setViewState('TransformContent', $value, '');
86 86
   }
87 87
 
88 88
   /**
89 89
    * @return string The path to the XML document. It must be in namespace format.
90 90
    */
91 91
   public function getDocumentPath() {
92
-    return $this->getViewState('DocumentPath', '');
92
+	return $this->getViewState('DocumentPath', '');
93 93
   }
94 94
 
95 95
   /**
@@ -97,27 +97,27 @@  discard block
 block discarded – undo
97 97
    * @throws TInvalidDataValueException
98 98
    */
99 99
   public function setDocumentPath($value) {
100
-    if(!is_file($value)) {
101
-      $value = Prado::getPathOfNamespace($value, self::EXT_XML_FILE);
102
-      if($value === null) {
100
+	if(!is_file($value)) {
101
+	  $value = Prado::getPathOfNamespace($value, self::EXT_XML_FILE);
102
+	  if($value === null) {
103 103
 	throw new TInvalidDataValueException('xmltransform_documentpath_invalid', $value);
104
-      }
105
-    }
106
-    $this->setViewState('DocumentPath', $value, '');
104
+	  }
105
+	}
106
+	$this->setViewState('DocumentPath', $value, '');
107 107
   }
108 108
 
109 109
   /**
110 110
    * @return string XML data
111 111
    */
112 112
   public function getDocumentContent() {
113
-    return $this->getViewState('DocumentContent', '');
113
+	return $this->getViewState('DocumentContent', '');
114 114
   }
115 115
 
116 116
   /**
117 117
    * @param string $value XML data. If not empty, it takes precedence over {@link setDocumentPath DocumentPath}.
118 118
    */
119 119
   public function setDocumentContent($value) {
120
-    $this->setViewState('DocumentContent', $value, '');
120
+	$this->setViewState('DocumentContent', $value, '');
121 121
   }
122 122
 
123 123
   /**
@@ -125,41 +125,41 @@  discard block
 block discarded – undo
125 125
    * @return TAttributeCollection the list of custom parameters
126 126
    */
127 127
   public function getParameters() {
128
-    if($params = $this->getViewState('Parameters',null)) {
129
-      return $params;
130
-    } else {
131
-      $params = new TAttributeCollection();
132
-      $this->setViewState('Parameters', $params, null);
133
-      return $params;
134
-    }
128
+	if($params = $this->getViewState('Parameters',null)) {
129
+	  return $params;
130
+	} else {
131
+	  $params = new TAttributeCollection();
132
+	  $this->setViewState('Parameters', $params, null);
133
+	  return $params;
134
+	}
135 135
   }
136 136
 
137 137
   private function getTransformXmlDocument() {
138
-    if(($content = $this->getTransformContent()) !== '') {
139
-      $document = new DOMDocument();
140
-      $document->loadXML($content);
141
-      return $document;
142
-    } else if(($path = $this->getTransformPath()) !== '') {
143
-      $document = new DOMDocument();
144
-      $document->load($path);
145
-      return $document;
146
-    } else {
147
-      throw new TConfigurationException('xmltransform_transform_required');
148
-    }
138
+	if(($content = $this->getTransformContent()) !== '') {
139
+	  $document = new DOMDocument();
140
+	  $document->loadXML($content);
141
+	  return $document;
142
+	} else if(($path = $this->getTransformPath()) !== '') {
143
+	  $document = new DOMDocument();
144
+	  $document->load($path);
145
+	  return $document;
146
+	} else {
147
+	  throw new TConfigurationException('xmltransform_transform_required');
148
+	}
149 149
   }
150 150
 
151 151
   private function getSourceXmlDocument() {
152
-    if(($content = $this->getDocumentContent()) !== '') {
153
-      $document = new DOMDocument();
154
-      $document->loadXML($content);
155
-      return $document;
156
-    } else if(($path = $this->getDocumentPath()) !== '') {
157
-      $document = new DOMDocument();
158
-      $document->load($path);
159
-      return $document;
160
-    } else {
161
-      return null;
162
-    }
152
+	if(($content = $this->getDocumentContent()) !== '') {
153
+	  $document = new DOMDocument();
154
+	  $document->loadXML($content);
155
+	  return $document;
156
+	} else if(($path = $this->getDocumentPath()) !== '') {
157
+	  $document = new DOMDocument();
158
+	  $document->load($path);
159
+	  return $document;
160
+	} else {
161
+	  return null;
162
+	}
163 163
   }
164 164
 
165 165
   /**
@@ -167,27 +167,27 @@  discard block
 block discarded – undo
167 167
    * @param THtmlWriter The writer used for the rendering purpose
168 168
    */
169 169
   public function render($writer) {
170
-    if(($document=$this->getSourceXmlDocument()) === null) {
170
+	if(($document=$this->getSourceXmlDocument()) === null) {
171 171
 	  $htmlWriter = Prado::createComponent($this->GetResponse()->getHtmlWriterType(), new TTextWriter());
172 172
 	  parent::render($htmlWriter);
173
-      $document = new DOMDocument();
174
-      $document->loadXML($htmlWriter->flush());
175
-    }
176
-    $stylesheet = $this->getTransformXmlDocument();
177
-
178
-    // Perform XSL transformation
179
-    $xslt = new XSLTProcessor();
180
-    $xslt->importStyleSheet($stylesheet);
181
-
182
-    // Check for parameters
183
-    $parameters = $this->getParameters();
184
-    foreach($parameters as $name => $value) {
185
-      $xslt->setParameter('', $name, $value);
186
-    }
187
-    $output = $xslt->transformToXML($document);
188
-
189
-    // Write output
190
-    $writer->write($output);
173
+	  $document = new DOMDocument();
174
+	  $document->loadXML($htmlWriter->flush());
175
+	}
176
+	$stylesheet = $this->getTransformXmlDocument();
177
+
178
+	// Perform XSL transformation
179
+	$xslt = new XSLTProcessor();
180
+	$xslt->importStyleSheet($stylesheet);
181
+
182
+	// Check for parameters
183
+	$parameters = $this->getParameters();
184
+	foreach($parameters as $name => $value) {
185
+	  $xslt->setParameter('', $name, $value);
186
+	}
187
+	$output = $xslt->transformToXML($document);
188
+
189
+	// Write output
190
+	$writer->write($output);
191 191
   }
192 192
 }
193 193
 
Please login to merge, or discard this patch.
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -46,7 +46,7 @@  discard block
 block discarded – undo
46 46
    * @throws TConfigurationException If XSL extension is not available
47 47
    */
48 48
   public function __construct() {
49
-    if(!class_exists('XSLTProcessor', false)) {
49
+    if (!class_exists('XSLTProcessor', false)) {
50 50
       throw new TConfigurationException('xmltransform_xslextension_required');
51 51
     }
52 52
   }
@@ -62,9 +62,9 @@  discard block
 block discarded – undo
62 62
    * @param string The path to the XML style sheet.  It must be in namespace format.
63 63
    */
64 64
   public function setTransformPath($value) {
65
-    if(!is_file($value)) {
65
+    if (!is_file($value)) {
66 66
       $value = Prado::getPathOfNamespace($value, self::EXT_XSL_FILE);
67
-      if($value === null) {
67
+      if ($value === null) {
68 68
 	throw new TInvalidDataValueException('xmltransform_transformpath_invalid', $value);
69 69
       }
70 70
     }
@@ -97,9 +97,9 @@  discard block
 block discarded – undo
97 97
    * @throws TInvalidDataValueException
98 98
    */
99 99
   public function setDocumentPath($value) {
100
-    if(!is_file($value)) {
100
+    if (!is_file($value)) {
101 101
       $value = Prado::getPathOfNamespace($value, self::EXT_XML_FILE);
102
-      if($value === null) {
102
+      if ($value === null) {
103 103
 	throw new TInvalidDataValueException('xmltransform_documentpath_invalid', $value);
104 104
       }
105 105
     }
@@ -125,7 +125,7 @@  discard block
 block discarded – undo
125 125
    * @return TAttributeCollection the list of custom parameters
126 126
    */
127 127
   public function getParameters() {
128
-    if($params = $this->getViewState('Parameters',null)) {
128
+    if ($params = $this->getViewState('Parameters', null)) {
129 129
       return $params;
130 130
     } else {
131 131
       $params = new TAttributeCollection();
@@ -135,11 +135,11 @@  discard block
 block discarded – undo
135 135
   }
136 136
 
137 137
   private function getTransformXmlDocument() {
138
-    if(($content = $this->getTransformContent()) !== '') {
138
+    if (($content = $this->getTransformContent()) !== '') {
139 139
       $document = new DOMDocument();
140 140
       $document->loadXML($content);
141 141
       return $document;
142
-    } else if(($path = $this->getTransformPath()) !== '') {
142
+    } else if (($path = $this->getTransformPath()) !== '') {
143 143
       $document = new DOMDocument();
144 144
       $document->load($path);
145 145
       return $document;
@@ -149,11 +149,11 @@  discard block
 block discarded – undo
149 149
   }
150 150
 
151 151
   private function getSourceXmlDocument() {
152
-    if(($content = $this->getDocumentContent()) !== '') {
152
+    if (($content = $this->getDocumentContent()) !== '') {
153 153
       $document = new DOMDocument();
154 154
       $document->loadXML($content);
155 155
       return $document;
156
-    } else if(($path = $this->getDocumentPath()) !== '') {
156
+    } else if (($path = $this->getDocumentPath()) !== '') {
157 157
       $document = new DOMDocument();
158 158
       $document->load($path);
159 159
       return $document;
@@ -167,7 +167,7 @@  discard block
 block discarded – undo
167 167
    * @param THtmlWriter The writer used for the rendering purpose
168 168
    */
169 169
   public function render($writer) {
170
-    if(($document=$this->getSourceXmlDocument()) === null) {
170
+    if (($document = $this->getSourceXmlDocument()) === null) {
171 171
 	  $htmlWriter = Prado::createComponent($this->GetResponse()->getHtmlWriterType(), new TTextWriter());
172 172
 	  parent::render($htmlWriter);
173 173
       $document = new DOMDocument();
@@ -181,7 +181,7 @@  discard block
 block discarded – undo
181 181
 
182 182
     // Check for parameters
183 183
     $parameters = $this->getParameters();
184
-    foreach($parameters as $name => $value) {
184
+    foreach ($parameters as $name => $value) {
185 185
       $xslt->setParameter('', $name, $value);
186 186
     }
187 187
     $output = $xslt->transformToXML($document);
Please login to merge, or discard this patch.
framework/Wsat/TWsatARGenerator.php 3 patches
Doc Comments   +4 added lines patch added patch discarded remove patch
@@ -207,6 +207,10 @@
 block discarded – undo
207 207
                 return $code;
208 208
         }
209 209
 
210
+        /**
211
+         * @param string $classname
212
+         * @param string $toString
213
+         */
210 214
         protected function generateClass($properties, $tablename, $classname, $toString)
211 215
         {
212 216
                 $props = implode("\n", $properties);
Please login to merge, or discard this patch.
Indentation   +193 added lines, -193 removed lines patch added patch discarded remove patch
@@ -14,206 +14,206 @@  discard block
 block discarded – undo
14 14
 class TWsatARGenerator extends TWsatBaseGenerator
15 15
 {
16 16
 
17
-        /**
18
-         * Class name prefix
19
-         */
20
-        private $_clasPrefix;
21
-
22
-        /**
23
-         * Class name sufix
24
-         */
25
-        private $_classSufix;
26
-
27
-        /**
28
-         * all table relations array
29
-         */
30
-        private $_relations;
31
-
32
-        /**
33
-         * unquote chars
34
-         * @var array
35
-         */
36
-        private $uqChars = array('[', ']', '"', '`', "'");
37
-
38
-        function __construct()
39
-        {
40
-                parent::__construct();
41
-        }
42
-
43
-        public function setClasPrefix($_clas_prefix)
44
-        {
45
-                $this->_clasPrefix = $_clas_prefix;
46
-        }
47
-
48
-        public function setClassSufix($_clas_sufix)
49
-        {
50
-                $this->_classSufix = $_clas_sufix;
51
-        }
17
+		/**
18
+		 * Class name prefix
19
+		 */
20
+		private $_clasPrefix;
21
+
22
+		/**
23
+		 * Class name sufix
24
+		 */
25
+		private $_classSufix;
26
+
27
+		/**
28
+		 * all table relations array
29
+		 */
30
+		private $_relations;
31
+
32
+		/**
33
+		 * unquote chars
34
+		 * @var array
35
+		 */
36
+		private $uqChars = array('[', ']', '"', '`', "'");
37
+
38
+		function __construct()
39
+		{
40
+				parent::__construct();
41
+		}
42
+
43
+		public function setClasPrefix($_clas_prefix)
44
+		{
45
+				$this->_clasPrefix = $_clas_prefix;
46
+		}
47
+
48
+		public function setClassSufix($_clas_sufix)
49
+		{
50
+				$this->_classSufix = $_clas_sufix;
51
+		}
52 52
 
53 53
 //-----------------------------------------------------------------------------
54
-        // <editor-fold defaultstate="collapsed" desc="Main APIs">
55
-        public function generate($tableName)
56
-        {
57
-                $tableInfo = $this->_dbMetaData->getTableInfo($tableName);
58
-                $this->_commonGenerate($tableName, $tableInfo);
59
-        }
60
-
61
-        public function generateAll()
62
-        {
63
-                foreach ($this->getAllTableNames() as $tableName)
64
-                {
65
-                        $tableInfo = $this->_dbMetaData->getTableInfo($tableName);
66
-                        if (!empty($this->_relations))
67
-                        {
68
-                                // Cancel generation of M-M relationships middle table
69
-                                if (count($tableInfo->getPrimaryKeys()) === 2 && count($tableInfo->getColumns()) === 2)//M-M relationships
70
-                                        continue;
71
-                        }
72
-                        $this->_commonGenerate($tableName, $tableInfo);
73
-                }
74
-        }
75
-
76
-        public function buildRelations()
77
-        {
78
-                $this->_relations = array();
79
-                foreach ($this->getAllTableNames() as $table_name)
80
-                {
81
-                        $tableInfo = $this->_dbMetaData->getTableInfo($table_name);
82
-                        $pks = $tableInfo->getPrimaryKeys();
83
-                        $fks = $tableInfo->getForeignKeys();
84
-
85
-                        if (count($pks) === 2 && count($tableInfo->getColumns()) === 2)//M-M relationships
86
-                        {
87
-                                $table_name_mm = $fks[0]["table"];
88
-                                $table_name_mm2 = $fks[1]["table"];
89
-
90
-                                $this->_relations[$table_name_mm][] = array(
91
-                                        "prop_name" => strtolower($table_name_mm2),
92
-                                        "rel_type" => "self::MANY_TO_MANY",
93
-                                        "ref_class_name" => $this->_getProperClassName($table_name_mm2),
94
-                                        "prop_ref" => $table_name
95
-                                );
96
-
97
-                                $this->_relations[$table_name_mm2][] = array(
98
-                                        "prop_name" => strtolower($table_name_mm),
99
-                                        "rel_type" => "self::MANY_TO_MANY",
100
-                                        "ref_class_name" => $this->_getProperClassName($table_name_mm),
101
-                                        "prop_ref" => $table_name
102
-                                );
103
-                                continue;
104
-                        }
105
-                        foreach ($fks as $fk_data)//1-M relationships
106
-                        {
107
-                                $owner_table = $fk_data["table"];
108
-                                $slave_table = $table_name;
109
-                                $fk_prop = key($fk_data["keys"]);
110
-
111
-                                $this->_relations[$owner_table][] = array(
112
-                                        "prop_name" => strtolower($slave_table),
113
-                                        "rel_type" => "self::HAS_MANY",
114
-                                        "ref_class_name" => $this->_getProperClassName($slave_table),
115
-                                        "prop_ref" => $fk_prop
116
-                                );
117
-
118
-                                $this->_relations[$slave_table][] = array(
119
-                                        "prop_name" => strtolower($owner_table),
120
-                                        "rel_type" => "self::BELONGS_TO",
121
-                                        "ref_class_name" => $this->_getProperClassName($owner_table),
122
-                                        "prop_ref" => $fk_prop
123
-                                );
124
-                        }
125
-                }
126
-        }
54
+		// <editor-fold defaultstate="collapsed" desc="Main APIs">
55
+		public function generate($tableName)
56
+		{
57
+				$tableInfo = $this->_dbMetaData->getTableInfo($tableName);
58
+				$this->_commonGenerate($tableName, $tableInfo);
59
+		}
60
+
61
+		public function generateAll()
62
+		{
63
+				foreach ($this->getAllTableNames() as $tableName)
64
+				{
65
+						$tableInfo = $this->_dbMetaData->getTableInfo($tableName);
66
+						if (!empty($this->_relations))
67
+						{
68
+								// Cancel generation of M-M relationships middle table
69
+								if (count($tableInfo->getPrimaryKeys()) === 2 && count($tableInfo->getColumns()) === 2)//M-M relationships
70
+										continue;
71
+						}
72
+						$this->_commonGenerate($tableName, $tableInfo);
73
+				}
74
+		}
75
+
76
+		public function buildRelations()
77
+		{
78
+				$this->_relations = array();
79
+				foreach ($this->getAllTableNames() as $table_name)
80
+				{
81
+						$tableInfo = $this->_dbMetaData->getTableInfo($table_name);
82
+						$pks = $tableInfo->getPrimaryKeys();
83
+						$fks = $tableInfo->getForeignKeys();
84
+
85
+						if (count($pks) === 2 && count($tableInfo->getColumns()) === 2)//M-M relationships
86
+						{
87
+								$table_name_mm = $fks[0]["table"];
88
+								$table_name_mm2 = $fks[1]["table"];
89
+
90
+								$this->_relations[$table_name_mm][] = array(
91
+										"prop_name" => strtolower($table_name_mm2),
92
+										"rel_type" => "self::MANY_TO_MANY",
93
+										"ref_class_name" => $this->_getProperClassName($table_name_mm2),
94
+										"prop_ref" => $table_name
95
+								);
96
+
97
+								$this->_relations[$table_name_mm2][] = array(
98
+										"prop_name" => strtolower($table_name_mm),
99
+										"rel_type" => "self::MANY_TO_MANY",
100
+										"ref_class_name" => $this->_getProperClassName($table_name_mm),
101
+										"prop_ref" => $table_name
102
+								);
103
+								continue;
104
+						}
105
+						foreach ($fks as $fk_data)//1-M relationships
106
+						{
107
+								$owner_table = $fk_data["table"];
108
+								$slave_table = $table_name;
109
+								$fk_prop = key($fk_data["keys"]);
110
+
111
+								$this->_relations[$owner_table][] = array(
112
+										"prop_name" => strtolower($slave_table),
113
+										"rel_type" => "self::HAS_MANY",
114
+										"ref_class_name" => $this->_getProperClassName($slave_table),
115
+										"prop_ref" => $fk_prop
116
+								);
117
+
118
+								$this->_relations[$slave_table][] = array(
119
+										"prop_name" => strtolower($owner_table),
120
+										"rel_type" => "self::BELONGS_TO",
121
+										"ref_class_name" => $this->_getProperClassName($owner_table),
122
+										"prop_ref" => $fk_prop
123
+								);
124
+						}
125
+				}
126
+		}
127 127
 
128 128
 // </editor-fold>
129 129
 //-----------------------------------------------------------------------------
130
-        // <editor-fold defaultstate="collapsed" desc="Common Methods">
131
-
132
-        private function _commonGenerate($tableName, $tableInfo)
133
-        {
134
-                if (count($tableInfo->getColumns()) === 0)
135
-                        throw new Exception("Unable to find table or view $tableName in " . $this->_dbMetaData->getDbConnection()->getConnectionString() . ".");
136
-                else
137
-                {
138
-                        $properties = array();
139
-                        foreach ($tableInfo->getColumns() as $field => $metadata)
140
-                                $properties[] = $this->generateProperty($field, $metadata);
141
-                        $toString = $this->_buildSmartToString($tableInfo);
142
-                }
143
-
144
-                $clasName = $this->_getProperClassName($tableName);
145
-                $class = $this->generateClass($properties, $tableName, $clasName, $toString);
146
-                $output = $this->_opFile . DIRECTORY_SEPARATOR . $clasName . ".php";
147
-                file_put_contents($output, $class);
148
-        }
149
-
150
-        private function _getProperClassName($tableName)
151
-        {
152
-                $table_name_words = str_replace("_", " ", strtolower($tableName));
153
-                $final_conversion = str_replace(" ", "", ucwords($table_name_words));
154
-                return $this->_clasPrefix . $final_conversion . $this->_classSufix;
155
-        }
130
+		// <editor-fold defaultstate="collapsed" desc="Common Methods">
131
+
132
+		private function _commonGenerate($tableName, $tableInfo)
133
+		{
134
+				if (count($tableInfo->getColumns()) === 0)
135
+						throw new Exception("Unable to find table or view $tableName in " . $this->_dbMetaData->getDbConnection()->getConnectionString() . ".");
136
+				else
137
+				{
138
+						$properties = array();
139
+						foreach ($tableInfo->getColumns() as $field => $metadata)
140
+								$properties[] = $this->generateProperty($field, $metadata);
141
+						$toString = $this->_buildSmartToString($tableInfo);
142
+				}
143
+
144
+				$clasName = $this->_getProperClassName($tableName);
145
+				$class = $this->generateClass($properties, $tableName, $clasName, $toString);
146
+				$output = $this->_opFile . DIRECTORY_SEPARATOR . $clasName . ".php";
147
+				file_put_contents($output, $class);
148
+		}
149
+
150
+		private function _getProperClassName($tableName)
151
+		{
152
+				$table_name_words = str_replace("_", " ", strtolower($tableName));
153
+				$final_conversion = str_replace(" ", "", ucwords($table_name_words));
154
+				return $this->_clasPrefix . $final_conversion . $this->_classSufix;
155
+		}
156 156
 
157 157
 //-----------------------------------------------------------------------------
158 158
 
159
-        protected function generateProperty($field, $metadata)
160
-        {
161
-                $prop = '';
162
-                $name = '$' . $field;
163
-
164
-                /* TODO use in version 2.0 */
165
-                // $type = $column->getPHPType();
166
-
167
-                $prop .= "\tpublic $name;";
168
-                return $prop;
169
-        }
170
-
171
-        private function _renderRelations($tablename)
172
-        {
173
-                if (!isset($this->_relations[$tablename]))
174
-                        return "";
175
-
176
-                $code = "\tpublic static \$RELATIONS = array (";
177
-                foreach ($this->_relations[$tablename] as $rel_data)
178
-                        $code .= "\n\t\t'" . $rel_data["prop_name"] . "' => array(" . $rel_data["rel_type"] . ", '" . $rel_data["ref_class_name"] . "', '" . $rel_data["prop_ref"] . "'),";
179
-
180
-                $code = substr($code, 0, -1);
181
-                $code .= "\n\t);";
182
-                return $code;
183
-        }
184
-
185
-        private function _buildSmartToString($tableInfo)
186
-        {
187
-                $code = "\tpublic function __toString() {";
188
-                $property = "throw new THttpException(500, 'Not implemented yet.');";
189
-                try
190
-                {
191
-                        foreach ($tableInfo->getColumns() as $column)
192
-                        {
193
-                                if (isset($column->IsPrimaryKey) && $column->IsPrimaryKey)
194
-                                        $property = str_replace($this->uqChars, "", $column->ColumnName);
195
-                                elseif ($column->PdoType == PDO::PARAM_STR && $column->DBType != "date")
196
-                                {
197
-                                        $property = str_replace($this->uqChars, "", $column->ColumnName);
198
-                                        break;
199
-                                }
200
-                        }
201
-                } catch (Exception $ex)
202
-                {
203
-                        Prado::trace($ex->getMessage());
204
-                }
205
-                $code .= "\n\t\treturn \$this->$property;";
206
-                $code .= "\n\t}";
207
-                return $code;
208
-        }
209
-
210
-        protected function generateClass($properties, $tablename, $classname, $toString)
211
-        {
212
-                $props = implode("\n", $properties);
213
-                $relations = $this->_renderRelations($tablename);
214
-                $date = date('Y-m-d h:i:s');
215
-                $env_user = getenv("username");
216
-                return <<<EOD
159
+		protected function generateProperty($field, $metadata)
160
+		{
161
+				$prop = '';
162
+				$name = '$' . $field;
163
+
164
+				/* TODO use in version 2.0 */
165
+				// $type = $column->getPHPType();
166
+
167
+				$prop .= "\tpublic $name;";
168
+				return $prop;
169
+		}
170
+
171
+		private function _renderRelations($tablename)
172
+		{
173
+				if (!isset($this->_relations[$tablename]))
174
+						return "";
175
+
176
+				$code = "\tpublic static \$RELATIONS = array (";
177
+				foreach ($this->_relations[$tablename] as $rel_data)
178
+						$code .= "\n\t\t'" . $rel_data["prop_name"] . "' => array(" . $rel_data["rel_type"] . ", '" . $rel_data["ref_class_name"] . "', '" . $rel_data["prop_ref"] . "'),";
179
+
180
+				$code = substr($code, 0, -1);
181
+				$code .= "\n\t);";
182
+				return $code;
183
+		}
184
+
185
+		private function _buildSmartToString($tableInfo)
186
+		{
187
+				$code = "\tpublic function __toString() {";
188
+				$property = "throw new THttpException(500, 'Not implemented yet.');";
189
+				try
190
+				{
191
+						foreach ($tableInfo->getColumns() as $column)
192
+						{
193
+								if (isset($column->IsPrimaryKey) && $column->IsPrimaryKey)
194
+										$property = str_replace($this->uqChars, "", $column->ColumnName);
195
+								elseif ($column->PdoType == PDO::PARAM_STR && $column->DBType != "date")
196
+								{
197
+										$property = str_replace($this->uqChars, "", $column->ColumnName);
198
+										break;
199
+								}
200
+						}
201
+				} catch (Exception $ex)
202
+				{
203
+						Prado::trace($ex->getMessage());
204
+				}
205
+				$code .= "\n\t\treturn \$this->$property;";
206
+				$code .= "\n\t}";
207
+				return $code;
208
+		}
209
+
210
+		protected function generateClass($properties, $tablename, $classname, $toString)
211
+		{
212
+				$props = implode("\n", $properties);
213
+				$relations = $this->_renderRelations($tablename);
214
+				$date = date('Y-m-d h:i:s');
215
+				$env_user = getenv("username");
216
+				return <<<EOD
217 217
 <?php
218 218
 /**
219 219
  * Auto generated by PRADO - WSAT on $date.
@@ -234,7 +234,7 @@  discard block
 block discarded – undo
234 234
 $toString
235 235
 }
236 236
 EOD;
237
-        }
237
+		}
238 238
 
239 239
 // </editor-fold>
240 240
 }
241 241
\ No newline at end of file
Please login to merge, or discard this patch.
Braces   +24 added lines, -15 removed lines patch added patch discarded remove patch
@@ -66,8 +66,10 @@  discard block
 block discarded – undo
66 66
                         if (!empty($this->_relations))
67 67
                         {
68 68
                                 // Cancel generation of M-M relationships middle table
69
-                                if (count($tableInfo->getPrimaryKeys()) === 2 && count($tableInfo->getColumns()) === 2)//M-M relationships
69
+                                if (count($tableInfo->getPrimaryKeys()) === 2 && count($tableInfo->getColumns()) === 2) {
70
+                                	//M-M relationships
70 71
                                         continue;
72
+                                }
71 73
                         }
72 74
                         $this->_commonGenerate($tableName, $tableInfo);
73 75
                 }
@@ -82,9 +84,11 @@  discard block
 block discarded – undo
82 84
                         $pks = $tableInfo->getPrimaryKeys();
83 85
                         $fks = $tableInfo->getForeignKeys();
84 86
 
85
-                        if (count($pks) === 2 && count($tableInfo->getColumns()) === 2)//M-M relationships
87
+                        if (count($pks) === 2 && count($tableInfo->getColumns()) === 2) {
88
+                        	//M-M relationships
86 89
                         {
87 90
                                 $table_name_mm = $fks[0]["table"];
91
+                        }
88 92
                                 $table_name_mm2 = $fks[1]["table"];
89 93
 
90 94
                                 $this->_relations[$table_name_mm][] = array(
@@ -102,9 +106,11 @@  discard block
 block discarded – undo
102 106
                                 );
103 107
                                 continue;
104 108
                         }
105
-                        foreach ($fks as $fk_data)//1-M relationships
109
+                        foreach ($fks as $fk_data) {
110
+                        	//1-M relationships
106 111
                         {
107 112
                                 $owner_table = $fk_data["table"];
113
+                        }
108 114
                                 $slave_table = $table_name;
109 115
                                 $fk_prop = key($fk_data["keys"]);
110 116
 
@@ -131,13 +137,14 @@  discard block
 block discarded – undo
131 137
 
132 138
         private function _commonGenerate($tableName, $tableInfo)
133 139
         {
134
-                if (count($tableInfo->getColumns()) === 0)
135
-                        throw new Exception("Unable to find table or view $tableName in " . $this->_dbMetaData->getDbConnection()->getConnectionString() . ".");
136
-                else
140
+                if (count($tableInfo->getColumns()) === 0) {
141
+                                        throw new Exception("Unable to find table or view $tableName in " . $this->_dbMetaData->getDbConnection()->getConnectionString() . ".");
142
+                } else
137 143
                 {
138 144
                         $properties = array();
139
-                        foreach ($tableInfo->getColumns() as $field => $metadata)
140
-                                $properties[] = $this->generateProperty($field, $metadata);
145
+                        foreach ($tableInfo->getColumns() as $field => $metadata) {
146
+                                                        $properties[] = $this->generateProperty($field, $metadata);
147
+                        }
141 148
                         $toString = $this->_buildSmartToString($tableInfo);
142 149
                 }
143 150
 
@@ -170,12 +177,14 @@  discard block
 block discarded – undo
170 177
 
171 178
         private function _renderRelations($tablename)
172 179
         {
173
-                if (!isset($this->_relations[$tablename]))
174
-                        return "";
180
+                if (!isset($this->_relations[$tablename])) {
181
+                                        return "";
182
+                }
175 183
 
176 184
                 $code = "\tpublic static \$RELATIONS = array (";
177
-                foreach ($this->_relations[$tablename] as $rel_data)
178
-                        $code .= "\n\t\t'" . $rel_data["prop_name"] . "' => array(" . $rel_data["rel_type"] . ", '" . $rel_data["ref_class_name"] . "', '" . $rel_data["prop_ref"] . "'),";
185
+                foreach ($this->_relations[$tablename] as $rel_data) {
186
+                                        $code .= "\n\t\t'" . $rel_data["prop_name"] . "' => array(" . $rel_data["rel_type"] . ", '" . $rel_data["ref_class_name"] . "', '" . $rel_data["prop_ref"] . "'),";
187
+                }
179 188
 
180 189
                 $code = substr($code, 0, -1);
181 190
                 $code .= "\n\t);";
@@ -190,9 +199,9 @@  discard block
 block discarded – undo
190 199
                 {
191 200
                         foreach ($tableInfo->getColumns() as $column)
192 201
                         {
193
-                                if (isset($column->IsPrimaryKey) && $column->IsPrimaryKey)
194
-                                        $property = str_replace($this->uqChars, "", $column->ColumnName);
195
-                                elseif ($column->PdoType == PDO::PARAM_STR && $column->DBType != "date")
202
+                                if (isset($column->IsPrimaryKey) && $column->IsPrimaryKey) {
203
+                                                                        $property = str_replace($this->uqChars, "", $column->ColumnName);
204
+                                } elseif ($column->PdoType == PDO::PARAM_STR && $column->DBType != "date")
196 205
                                 {
197 206
                                         $property = str_replace($this->uqChars, "", $column->ColumnName);
198 207
                                         break;
Please login to merge, or discard this patch.