summaryrefslogtreecommitdiff
path: root/framework/Web/UI/WebControls/TRadioButtonList.php
blob: e434e70951765434ef3450b982a5572581f14826 (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
<?php

class TRadioButtonList extends TCheckBoxList
{
	protected function getIsMultiSelect()
	{
		return false;
	}

	protected function createRepeatedControl()
	{
		return new TRadioButton;
	}

	public function loadPostData($key,$values)
	{
		$value=isset($values[$key])?$values[$key]:'';
		$oldSelection=$this->getSelectedIndex();
		$this->ensureDataBound();
		foreach($this->getItems() as $index=>$item)
		{
			if($item->getEnabled() && $item->getValue()===$value)
			{
				if($index===$oldSelection)
					return false;
				else
				{
					$this->setSelectedIndex($index);
					return true;
				}
			}
		}
		return false;
	}
}

?>