public function actionGetCities() { $region = Yii::app()->request->getQuery('region', 0); $type = Yii::app()->request->getQuery('type', 0); $cities = City::getCitiesArray($region, $type); foreach ($cities as $value => $name) { echo CHtml::tag('option', array('value' => $value), CHtml::encode($name), true); } }
<p><?php echo tt('The file is exported to the UTP-8 without BOM charset.'); ?> </p> <p><?php echo tt('Separators are ";".'); ?> </p> </div> <?php $columns = array(array('class' => 'CCheckBoxColumn', 'header' => tt('Select'), 'id' => 'itemsSelectedExport'), array('name' => 'id', 'htmlOptions' => array('class' => 'apartments_id_column', 'style' => 'text-align: center;'), 'sortable' => false), array('name' => 'active', 'type' => 'raw', 'value' => 'Yii::app()->controller->returnControllerStatusHtml($data, "apartments-grid", 1)', 'htmlOptions' => array('class' => 'apartments_status_column'), 'filter' => Apartment::getModerationStatusArray(), 'sortable' => false), array('name' => 'type', 'type' => 'raw', 'value' => 'Apartment::getNameByType($data->type)', 'htmlOptions' => array('style' => 'width: 100px;'), 'filter' => Apartment::getTypesArray(), 'sortable' => false)); if (issetModule('location')) { $columns[] = array('name' => 'loc_country', 'value' => '$data->loc_country ? $data->locCountry->name : ""', 'htmlOptions' => array('style' => 'width: 150px;'), 'sortable' => false, 'filter' => Country::getCountriesArray(0, 1)); $columns[] = array('name' => 'loc_region', 'value' => '$data->loc_region ? $data->locRegion->name : ""', 'htmlOptions' => array('style' => 'width: 150px;'), 'sortable' => false, 'filter' => Region::getRegionsArray($model->loc_country, 0, 1)); $columns[] = array('name' => 'loc_city', 'value' => '$data->loc_city ? $data->locCity->name : ""', 'htmlOptions' => array('style' => 'width: 150px;'), 'sortable' => false, 'filter' => City::getCitiesArray($model->loc_region, 0, 1)); } else { $columns[] = array('name' => 'city_id', 'value' => '(isset($data->city ) && $data->city_id) ? $data->city->name : ""', 'htmlOptions' => array('style' => 'width: 150px;'), 'filter' => ApartmentCity::getAllCity(), 'sortable' => false); } $columns[] = array('name' => 'ownerEmail', 'htmlOptions' => array('style' => 'width: 150px;'), 'type' => 'raw', 'value' => '(isset($data->user) && $data->user->role != "admin") ? CHtml::link(CHtml::encode($data->user->email), array("/users/backend/main/view","id" => $data->user->id)) : tt("administrator", "common")'); $columns[] = array('header' => tc('Name'), 'name' => 'title_' . Yii::app()->language, 'type' => 'raw', 'value' => 'CHtml::link(CHtml::encode($data->{"title_".Yii::app()->language}), $data->getUrl())', 'sortable' => false); ?> <div class="form"> <?php $this->widget('CustomHistoryGridView', array('id' => 'export-grid', 'dataProvider' => $model->searchExport(), 'filter' => $model, 'selectableRows' => 2, 'selectionChanged' => 'js:selItemsSelected', 'columns' => $columns)); ?> <?php $form = $this->beginWidget('CActiveForm', array('id' => 'export-form', 'method' => 'post', 'action' => $this->createAbsoluteUrl('/iecsv/backend/main/export'), 'enableClientValidation' => false));
echo CHtml::label($model->getAttributeLabel('userType'), 'userType'); echo $form->dropDownList($model, 'type', CArray::merge(array(0 => tc('Please select')), User::getTypeList()), array('id' => 'userType')); ?> <?php echo CHtml::label($model->getAttributeLabel('withListings'), 'withListings'); echo $form->dropDownList($model, 'withListings', CArray::merge(array('' => tc('Please select')), array(0 => tc('No'), 1 => tc('Ok'))), array('id' => 'withListings')); ?> <?php if (issetModule('location')) { echo CHtml::label($model->getAttributeLabel('countryListing'), 'countryListing'); echo CHtml::dropDownList('Mailing[countryListing]', isset($this->selectedCountry) ? $this->selectedCountry : '', Country::getCountriesArray(2), array('class' => 'width285 searchField', 'id' => 'countryListing', 'ajax' => array('type' => 'GET', 'url' => $this->createUrl('/location/main/getRegions'), 'data' => 'js:"country="+$("#countryListing").val()+"&type=2"', 'success' => 'function(result){ $("#regionListing").html(result); $("#regionListing").change(); }'))); echo CHtml::label($model->getAttributeLabel('regionListing'), 'regionListing'); echo CHtml::dropDownList('Mailing[regionListing]', isset($this->selectedRegion) ? $this->selectedRegion : '', Region::getRegionsArray(isset($this->selectedCountry) ? $this->selectedCountry : 0, 2), array('class' => 'width285 searchField', 'id' => 'regionListing', 'ajax' => array('type' => 'GET', 'url' => $this->createUrl('/location/main/getCities'), 'data' => 'js:"region="+$("#regionListing").val()+"&type=2"', 'success' => 'function(result){ $("#cityListing").html(result); $("#cityListing").change(); }'))); } ?> <?php echo CHtml::label($model->getAttributeLabel('cityListing'), 'cityListing'); echo CHtml::dropDownList('Mailing[cityListing]', isset($this->selectedCity) ? $this->selectedCity : '', issetModule('location') ? City::getCitiesArray(isset($this->selectedRegion) ? $this->selectedRegion : 0, 2) : CArray::merge(array(0 => tc('select city')), ApartmentCity::getActiveCity()), array('class' => 'width285 searchField', 'id' => 'cityListing')); ?> <?php $this->endWidget();
echo $divClass; ?> "> <?php if ($this->searchShowLabel) { ?> <div class="<?php echo $textClass; ?> "><?php echo Yii::t('common', 'City'); ?> :</div> <?php } ?> <div class="<?php echo $controlClass; ?> "> <?php $cityArray = issetModule('location') && param('useLocation', 1) ? City::getCitiesArray(isset($this->selectedRegion) ? $this->selectedRegion : 0, 0) : $this->cityActive; if ($this->defaultTheme == 'atlas') { $cityArray = CArray::merge(array(0 => tc('select city')), $cityArray); } echo CHtml::dropDownList('city[]', isset($this->selectedCity) ? $this->selectedCity : '', $cityArray, array('class' => $fieldClass . ' width289 searchField')); //SearchForm::setJsParam('cityField', array('minWidth' => $minWidth)); // ?> </div> </li>
<?php //при создании города узнаём id первой в дропдауне страны if ($model->loc_country) { $country = $model->loc_country; } else { $country_keys = array_keys($countries); $country = isset($country_keys[0]) ? $country_keys[0] : 0; } $regions = Region::getRegionsArray($country); if ($model->loc_region) { $region = $model->loc_region; } else { $region_keys = array_keys($regions); $region = isset($region_keys[0]) ? $region_keys[0] : 0; } $cities = City::getCitiesArray($region); if ($model->loc_city) { $city = $model->loc_city; } else { $city_keys = array_keys($cities); $city = isset($city_keys[0]) ? $city_keys[0] : 0; } ?> <div class="rowold"> <?php echo $form->labelEx($model, 'loc_region'); ?> <?php echo $form->dropDownList($model, 'loc_region', $regions, array('id' => 'ap_region', 'ajax' => array('type' => 'GET', 'url' => $this->createUrl('/location/main/getCities'), 'data' => 'js:"region="+$("#ap_region").val()', 'success' => 'function(result){ $("#ap_city").html(result);
?> </div> <div class=""> <div class=""><?php echo tc('Region'); ?> :</div> <?php echo CHtml::dropDownList('filter[region_id]', $this->getFilterValue('region_id'), Region::getRegionsArray($this->getFilterValue('country_id'), 2), array('class' => 'searchField', 'id' => 'region', 'ajax' => array('type' => 'GET', 'url' => $this->createUrl('/location/main/getCities'), 'data' => 'js:"region="+$("#region").val()+"&type=0"', 'success' => 'function(result){ $("#ap_city").html(result); }'))); ?> </div> <?php $cities = City::getCitiesArray($this->getFilterValue('region_id')); } $objTypes = CArray::merge(array(0 => ''), ApartmentObjType::getList()); $typeList = CArray::merge(array(0 => ''), Apartment::getTypesArray()); ?> <div class=""> <div class=""><?php echo Yii::t('common', 'City'); ?> :</div> <?php $cities = isset($cities) && count($cities) ? $cities : CArray::merge(array(0 => tc('select city')), ApartmentCity::getAllCity()); echo CHtml::dropDownList('filter[city_id]', $this->getFilterValue('city_id'), $cities, array('class' => ' searchField', 'id' => 'ap_city')); ?> </div>