diff options
Diffstat (limited to 'tests/FunctionalTests/active-controls/protected/pages/AutoCompleteTest.php')
| -rw-r--r-- | tests/FunctionalTests/active-controls/protected/pages/AutoCompleteTest.php | 34 | 
1 files changed, 34 insertions, 0 deletions
| diff --git a/tests/FunctionalTests/active-controls/protected/pages/AutoCompleteTest.php b/tests/FunctionalTests/active-controls/protected/pages/AutoCompleteTest.php new file mode 100644 index 00000000..938b8640 --- /dev/null +++ b/tests/FunctionalTests/active-controls/protected/pages/AutoCompleteTest.php @@ -0,0 +1,34 @@ +<?php +/* + * Created on 7/05/2006 + */ + +class AutoCompleteTest extends TPage +{ +	public function suggestCountries($sender, $param) +	{ +		$sender->setDataSource($this->matchCountries($param->getParameter())); +		$sender->dataBind(); +		$sender->render($param->getOutput()); +	} +	 +	protected function matchCountries($token) +	{ +		$info = Prado::createComponent('System.I18N.core.CultureInfo', 'en'); +		$list = array(); +		$count = 0; +		$token = strtolower($token); +		foreach($info->getCountries() as $country) +		{ +			if(strpos(strtolower($country), $token) === 0) +			{ +				$list[] = $country; +				$count++; +				if($count > 10) break; +			}	 +		} +		return $list;				  +	} +} + +?>
\ No newline at end of file | 
