public function init() { $this->states = States::model()->findAll('country_id=:country_id', array(':country_id' => 1)); $this->districts = Districts::model()->findAll(); $this->functionalAreas_models = FunctionalAreas::model()->findAll(); $this->latest_posts = Post::model()->findAll(array('order' => 'id DESC', 'limit' => 5)); $this->latest_resumes = User::model()->findAllByAttributes(array('showOnSearch' => 'Y'), array('order' => 'id DESC', 'limit' => 5)); }
public function actionDistricts() { $districts = Districts::model()->findAll('state_id=:state_id', array(':state_id' => (int) $_POST[$_GET['form']]['state'])); $districts = CHtml::listData($districts, 'id', 'district'); echo CHtml::tag('option', array('value' => ''), CHtml::encode('Select District'), true); foreach ($districts as $value => $name) { echo CHtml::tag('option', array('value' => $value), CHtml::encode($name), true); } }