summaryrefslogtreecommitdiff
path: root/framework/Web/UI/ActiveControls/TActiveButtonColumn.php
blob: cee7c86ee479054af690373ed64051b0009359a2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
<?php
/**
 * TActiveDataGrid class file
 *
 * @author LANDWEHR Computer und Software GmbH <programmierung@landwehr-software.de>
 * @link http://www.landwehr-software.de/
 * @copyright Copyright &copy; 2009 LANDWEHR Computer und Software GmbH
 * @license http://www.pradosoft.com/license/
 * @package Prado\Web\UI\ActiveControls
 */

namespace Prado\Web\UI\ActiveControls;

/**
 * TActiveButtonColumn class
 *
 * TActiveButtonColumn contains a user-defined command button, such as Add or Remove,
 * that corresponds with each row in the column.
 *
 * This is the active counterpart to the {@link TButtonColumn} control where the
 * button is replaced by the appropriate active button control.
 *
 * Please refer to the original documentation of the {@link TButtonColumn} for usage.
 *
 * @author LANDWEHR Computer und Software GmbH <programmierung@landwehr-software.de>
 * @package Prado\Web\UI\ActiveControls
 * @since 3.1.9
 */
class TActiveButtonColumn extends TButtonColumn {
	public function initializeCell($cell,$columnIndex,$itemType) {
		if($itemType===TListItemType::Item || $itemType===TListItemType::AlternatingItem || $itemType===TListItemType::SelectedItem || $itemType===TListItemType::EditItem) {
			$buttonType=$this->getButtonType();
			if($buttonType===TButtonColumnType::LinkButton)
				$button=new TActiveLinkButton;
			else if($buttonType===TButtonColumnType::PushButton)
					$button=new TActiveButton;
				else // image button
				{
					$button=new TActiveImageButton;
					$button->setImageUrl($this->getImageUrl());
					$button->setToolTip($this->getText());
				}
			$button->setText($this->getText());
			$button->setCommandName($this->getCommandName());
			$button->setCausesValidation($this->getCausesValidation());
			$button->setValidationGroup($this->getValidationGroup());
			if($this->getDataTextField()!=='' || ($buttonType===TButtonColumnType::ImageButton && $this->getDataImageUrlField()!==''))
				$button->attachEventHandler('OnDataBinding',array($this,'dataBindColumn'));
			$cell->getControls()->add($button);
			$cell->registerObject('Button',$button);
		}
		else
			parent::initializeCell($cell,$columnIndex,$itemType);
	}
}