Exemplo n.º 1
0
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>
Exemplo n.º 3
0
    ?>
        </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>

    <div class="rowold">
        <div class=""><?php 
echo tc('Type');
?>
:</div>
        <?php 
echo CHtml::dropDownList('filter[type]', $this->getFilterValue('type'), $typeList);
?>
    </div>

    <div class="rowold">
Exemplo n.º 4
0
 public static function getRegionsArray($country, $type = 0, $all = 0)
 {
     $active_str = $all ? '' : 'AND active = 1 ';
     if ($type != 4) {
         $sql = 'SELECT id, name_' . Yii::app()->language . ' AS name FROM {{location_region}} WHERE country_id = :country ' . $active_str . 'ORDER BY sorter ASC';
         $res = Yii::app()->db->createCommand($sql)->queryAll(true, array(':country' => $country));
     } else {
         $sql = 'SELECT id, name_' . Yii::app()->language . ' AS name FROM {{location_region}} ' . $active_str . 'ORDER BY sorter ASC';
         $res = Yii::app()->db->createCommand($sql)->queryAll();
     }
     $res = CHtml::listData($res, 'id', 'name');
     switch ($type) {
         case 1:
         case 4:
             $regions = CArray::merge(array(0 => ''), $res);
             break;
         case 2:
             $regions = CArray::merge(array(0 => tc('select region')), $res);
             break;
         case 3:
             $regions = CArray::merge(array(0 => tc('Not specified_m')), $res);
             break;
         default:
             $regions = $res;
     }
     return $regions;
 }
Exemplo n.º 5
0
 public static function getCountriesArray($type = 0, $all = 0)
 {
     // 0 - без первой строки, 1 - пустая первая строка, 2 - любой, 3 - не указан
     $active_str = $all ? '' : 'WHERE active = 1 ';
     $sql = 'SELECT id, name_' . Yii::app()->language . ' AS name FROM {{location_country}} ' . $active_str . 'ORDER BY sorter ASC';
     $res = Yii::app()->db->createCommand($sql)->queryAll();
     $res = CHtml::listData($res, 'id', 'name');
     switch ($type) {
         case 1:
             $countries = CArray::merge(array(0 => ''), $res);
             break;
         case 2:
             $countries = CArray::merge(array(0 => tc('select country')), $res);
             break;
         case 3:
             $countries = CArray::merge(array(0 => tc('Not specified_f')), $res);
             break;
         default:
             $countries = $res;
     }
     return $countries;
 }