Beispiel #1
0
	public function renderFilter() 
	{
		$filter = isset($_GET['filter']) ? $_GET['filter'] : null;
		$details = isset($_GET['filterDetails']) ? $_GET['filterDetails'] : ''; 
		
		if(isset($_GET['filterButton'])) 
			unset($_GET['filterButton']);
			
		$tmpGet = $_GET;
		if (isset($tmpGet['filter'])) {
			if (isset($tmpGet['filterDetails']))
				unset($tmpGet['filterDetails']);
			unset($tmpGet['filter']);
		}
		
		echo CHtml::form( Y::url('site', $tmpGet), 'get');
		echo CHtml::dropDownList('filter',$filter,array(
			'inYear'=>'по годам', 'inWorkType'=>'по видам деятельности','inCity'=>'по городам'
		));
		
		if ($filter) { 
			
			if ($filter == 'inYear')
				$items = Y::years();
			if ($filter == 'inCity') 
				$items = City::model()->allWithHeader;
			if ($filter == 'inWorkType') 
				$items = PortfolioWorkType::model()->allWithHeader;
				
			if (isset($items))
				echo CHtml::dropDownList('filterDetails', $details, $items);
		}
		
		echo CHtml::submitButton('Отфильтровать', array('name'=>'filterButton'));
		echo CHtml::endForm();
	}