/** * Return array of USA states * * @param void * @return array */ function get_usa_states() { static $instance; if (!instance_of($instance, 'UsaStates')) { require_once ANGIE_PATH . '/classes/resources/UsaStates.class.php'; $instance =& UsaStates::instance(); } // if return $instance->getStates(); }
public static function stateAdmin($model, $form, $attribute = 'state_id') { Yii::import('application.modules.helper.models.UsaStates'); $view = $form->dropDownListControlGroup($model, $attribute, CHtml::listData(UsaStates::model()->findAll(array('order' => 'state_name')), 'id', 'state_name'), array('class' => 'j-choosen', 'empty' => Yii::t('user', 'Choose State'))); Yii::app()->clientScript->registerPackage('choosen'); JS::add('choosen', "\$('.j-choosen').chosen({\n\t\t\t'search_contains':true,\n\t\t\t'width': '100%'\n\t\t});"); return $view; }