summaryrefslogtreecommitdiff
path: root/framework/Web/UI/ActiveControls/TActiveEditCommandColumn.php
blob: 60d5ab2906dae6e0d5ed2816347abb1c3d717fe4 (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
56
57
58
59
60
<?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;
use Prado\Prado;
use Prado\Web\UI\WebControls\TButtonColumnType;
use Prado\Web\UI\WebControls\TEditCommandColumn;

/**
 * TActiveEditCommandColumn class
 *
 * TActiveEditCommandColumn contains the Edit command buttons for editing data items in each row.
 *
 * TActiveEditCommandColumn will create an edit button if a cell is not in edit mode.
 * Otherwise an update button and a cancel button will be created within the cell.
 * The button captions are specified using {@link setEditText EditText},
 * {@link setUpdateText UpdateText}, and {@link setCancelText CancelText}.
 *
 * This is the active counterpart to the {@link TEditCommandColumn} control. The buttons for
 * interaction are replaced by active buttons.
 *
 * Please refer to the original documentation of the {@link TEditCommandColumn} for usage.
 *
 * @author LANDWEHR Computer und Software GmbH <programmierung@landwehr-software.de>
 * @package Prado\Web\UI\ActiveControls
 * @since 3.1.9
 */
class TActiveEditCommandColumn extends TEditCommandColumn {
	protected function createButton($commandName,$text,$causesValidation,$validationGroup) {
		if($this->getButtonType()===TButtonColumnType::LinkButton)
			$button=Prado::createComponent('System.Web.UI.WebControls.TActiveLinkButton');
		else if($this->getButtonType()===TButtonColumnType::PushButton)
				$button=Prado::createComponent('System.Web.UI.WebControls.TActiveButton');
			else  // image buttons
			{
				$button=Prado::createComponent('System.Web.UI.WebControls.TActiveImageButton');
				$button->setToolTip($text);
				if(strcasecmp($commandName,'Update')===0)
					$url=$this->getUpdateImageUrl();
				else if(strcasecmp($commandName,'Cancel')===0)
						$url=$this->getCancelImageUrl();
					else
						$url=$this->getEditImageUrl();
				$button->setImageUrl($url);
			}
		$button->setText($text);
		$button->setCommandName($commandName);
		$button->setCausesValidation($causesValidation);
		$button->setValidationGroup($validationGroup);
		return $button;
	}
}