summaryrefslogtreecommitdiff
path: root/framework/Web/UI/ActiveControls/TActiveDataGrid.php
diff options
context:
space:
mode:
authorctrlaltca@gmail.com <>2011-05-20 09:36:41 +0000
committerctrlaltca@gmail.com <>2011-05-20 09:36:41 +0000
commitc266d79c8370a536c9ccd0e9f0506ed65a22b9fe (patch)
tree9dd4b6e661d48fe1be9302dfec47bd150a46b2be /framework/Web/UI/ActiveControls/TActiveDataGrid.php
parent6091b82b4892e888092342a188a81832db8765d7 (diff)
added missing TLiteralColumn counterpart to TActiveDataGrid: class TActiveLiteralColumn
Diffstat (limited to 'framework/Web/UI/ActiveControls/TActiveDataGrid.php')
-rw-r--r--framework/Web/UI/ActiveControls/TActiveDataGrid.php81
1 files changed, 81 insertions, 0 deletions
diff --git a/framework/Web/UI/ActiveControls/TActiveDataGrid.php b/framework/Web/UI/ActiveControls/TActiveDataGrid.php
index 75e191fe..156a55a0 100644
--- a/framework/Web/UI/ActiveControls/TActiveDataGrid.php
+++ b/framework/Web/UI/ActiveControls/TActiveDataGrid.php
@@ -628,3 +628,84 @@ class TActiveDropDownListColumn extends TDropDownListColumn
}
}
+
+/**
+ * TActiveLiteralColumn class
+ *
+ * TActiveLiteralColumn represents a static text column that is bound to a field in a data source.
+ * The cells in the column will be displayed with static texts using the data indexed by
+ * {@link setDataField DataField}. You can customize the display by
+ * setting {@link setDataFormatString DataFormatString}.
+ *
+ * If {@link setDataField DataField} is not specified, the cells will be filled
+ * with {@link setText Text}.
+ *
+ * If {@link setEncode Encode} is true, the static texts will be HTML-encoded.
+ *
+ * This is the active counterpart to the {@link TLiteralColumn} control. For that purpose,
+ * if sorting is allowed, the header links/buttons are replaced by active controls.
+ *
+ * Please refer to the original documentation of the {@link TLiteralColumn} for usage.
+ *
+ * @author Fabio Bas <ctrlaltca@gmail.com>
+ * @package System.Web.UI.ActiveControls
+ * @since 3.2.0a
+ */
+class TActiveLiteralColumn extends TLiteralColumn {
+ protected function initializeHeaderCell($cell,$columnIndex) {
+ $text=$this->getHeaderText();
+
+ if(($classPath=$this->getHeaderRenderer())!=='') {
+ $control=Prado::createComponent($classPath);
+ if($control instanceof IDataRenderer) {
+ if($control instanceof IItemDataRenderer) {
+ $item=$cell->getParent();
+ $control->setItemIndex($item->getItemIndex());
+ $control->setItemType($item->getItemType());
+ }
+ $control->setData($text);
+ }
+ $cell->getControls()->add($control);
+ }
+ else if($this->getAllowSorting()) {
+ $sortExpression=$this->getSortExpression();
+ if(($url=$this->getHeaderImageUrl())!=='') {
+ $button=Prado::createComponent('System.Web.UI.WebControls.TActiveImageButton');
+ $button->setImageUrl($url);
+ $button->setCommandName(TDataGrid::CMD_SORT);
+ $button->setCommandParameter($sortExpression);
+ if($text!=='') {
+ $button->setAlternateText($text);
+ $button->setToolTip($text);
+ }
+ $button->setCausesValidation(false);
+ $cell->getControls()->add($button);
+ }
+ else if($text!=='') {
+ $button=Prado::createComponent('System.Web.UI.WebControls.TActiveLinkButton');
+ $button->setText($text);
+ $button->setCommandName(TDataGrid::CMD_SORT);
+ $button->setCommandParameter($sortExpression);
+ $button->setCausesValidation(false);
+ $cell->getControls()->add($button);
+ }
+ else
+ $cell->setText('&nbsp;');
+ }
+ else {
+ if(($url=$this->getHeaderImageUrl())!=='') {
+ $image=Prado::createComponent('System.Web.UI.WebControls.TActiveImage');
+ $image->setImageUrl($url);
+ if($text!=='') {
+ $image->setAlternateText($text);
+ $image->setToolTip($text);
+ }
+ $cell->getControls()->add($image);
+ }
+ else if($text!=='')
+ $cell->setText($text);
+ else
+ $cell->setText('&nbsp;');
+ }
+ }
+}