本文整理汇总了PHP中Region::getRegionsArray方法的典型用法代码示例。如果您正苦于以下问题:PHP Region::getRegionsArray方法的具体用法?PHP Region::getRegionsArray怎么用?PHP Region::getRegionsArray使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Region
的用法示例。
在下文中一共展示了Region::getRegionsArray方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: actionGetRegions
public function actionGetRegions()
{
$country = Yii::app()->request->getQuery('country', 0);
$type = Yii::app()->request->getQuery('type', 0);
$all = Yii::app()->request->getQuery('all', 0);
$regions = Region::getRegionsArray($country, $type, $all);
foreach ($regions as $value => $name) {
echo CHtml::tag('option', array('value' => $value), CHtml::encode($name), true);
}
}
示例2: search
public function search()
{
if (!$this->country_id || !in_array($this->region_id, array_keys(Region::getRegionsArray($this->country_id, 0, 1)))) {
$this->region_id = "";
}
$criteria = new CDbCriteria();
$tmp = 'name_' . Yii::app()->language;
$criteria->compare('t.' . $tmp, $this->{$tmp}, true);
$criteria->compare('t.active', $this->active);
$criteria->compare('t.country_id', $this->country_id);
$criteria->compare('t.region_id', $this->region_id);
$criteria->with = array('country', 'region');
$criteria->order = 'country.sorter ASC, region.sorter ASC, t.sorter ASC';
if ($this->region_id) {
$this->minSorter = Yii::app()->db->createCommand()->select('MIN(sorter) as minSorter')->from($this->tableName())->where('region_id=:id', array(':id' => $this->region_id))->queryScalar();
$this->maxSorter = Yii::app()->db->createCommand()->select('MAX(sorter) as maxSorter')->from($this->tableName())->where('region_id=:id', array(':id' => $this->region_id))->queryScalar();
}
return new CActiveDataProvider($this, array('criteria' => $criteria, 'pagination' => array('pageSize' => param('adminPaginationPageSize', 20))));
}
示例3: tt
<div>
<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
示例4: array_keys
<?php
//при создании города узнаём id первой в дропдауне страны
if ($model->country_id) {
$country = $model->country_id;
} else {
$country_keys = array_keys(Country::getCountriesArray(0, 1));
$country = isset($country_keys[0]) ? $country_keys[0] : 0;
}
?>
<div class="rowold">
<?php
echo $form->labelEx($model, 'region_id');
?>
<?php
echo $form->dropDownList($model, 'region_id', Region::getRegionsArray($country, 0, 1), array('id' => 'ap_region'));
?>
<?php
echo $form->error($model, 'region_id');
?>
</div>
<?php
$this->widget('application.modules.lang.components.langFieldWidget', array('model' => $model, 'field' => 'name', 'type' => 'string'));
?>
<div class="clear"></div>
<div class="rowold buttons">
<?php
$this->widget('bootstrap.widgets.TbButton', array('buttonType' => 'submit', 'type' => 'primary', 'icon' => 'ok white', 'label' => $model->isNewRecord ? tc('Add') : tc('Save')));
示例5: tc
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();
示例6: tc
<div class="<?php
echo $textClass;
?>
"><?php
echo tc('Region');
?>
:</div>
<?php
}
?>
<div class="<?php
echo $controlClass;
?>
">
<?php
echo CHtml::dropDownList('region', isset($this->selectedRegion) ? $this->selectedRegion : '', Region::getRegionsArray(219, 2), array('class' => $fieldClass . ' searchField', 'id' => 'region', 'ajax' => array('type' => 'GET', 'url' => $this->createUrl('/location/main/getCities'), 'data' => 'js:"region="+$("#region").val()+"&type=2"', 'success' => 'function(result){
changeSearch();
$("#city").html(result); $("#city").selectpicker("refresh");' . ($this->defaultTheme != 'atlas' ? '$("#city").multiselect("refresh")' : '') . '}')));
?>
</div>
</li>
<?php
}
?>
<li class="<?php
echo $divClass;
?>
">
<?php
示例7: array_keys
}'), 'class' => 'width240'));
?>
<?php
echo $form->error($model, 'loc_country');
?>
</div>
<?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;
}
?>
示例8: array
:</div>
<?php
echo CHtml::dropDownList('filter[country_id]', $this->getFilterValue('country_id'), Country::getCountriesArray(2), array('class' => 'searchField', 'id' => 'country', 'ajax' => array('type' => 'GET', 'url' => $this->createUrl('/location/main/getRegions'), 'data' => 'js:"country="+$("#country").val()+"&type=2"', 'success' => 'function(result){
$("#region").html(result);
$("#region").change();
}')));
?>
</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');
?>
示例9: array
<?php
$this->menu = array(array('label' => tt('Add city'), 'url' => array('/location/backend/city/create')));
$this->adminTitle = tt('Manage cities');
$this->widget('CustomGridView', array('id' => 'city-grid', 'dataProvider' => $model->search(), 'filter' => $model, 'afterAjaxUpdate' => 'function(id, data){$("a[rel=\'tooltip\']").tooltip(); $("div.tooltip-arrow").remove(); $("div.tooltip-inner").remove(); reInstallSortable(id, data);}', 'rowCssClassExpression' => '"items[]_{$data->id}"', 'columns' => array(array('class' => 'CCheckBoxColumn', 'id' => 'itemsSelected', 'selectableRows' => '2', 'htmlOptions' => array('class' => 'center')), array('name' => 'active', 'header' => tc('Status'), 'type' => 'raw', 'value' => 'Yii::app()->controller->returnStatusHtml($data, "city-grid", 1)', 'htmlOptions' => array('style' => 'width: 100px;'), 'sortable' => false, 'filter' => array('0' => tc('Inactive'), '1' => tc('Active'))), array('name' => 'country_id', 'value' => '$data->country_id ? $data->country->name : ""', 'htmlOptions' => array('style' => 'width: 150px;'), 'sortable' => false, 'filter' => Country::getCountriesArray(0, 1)), array('name' => 'region_id', 'value' => '$data->region_id ? $data->region->name : ""', 'htmlOptions' => array('style' => 'width: 150px;'), 'sortable' => false, 'filter' => Region::getRegionsArray($model->country_id, 0, 1)), array('header' => tc('Name'), 'name' => 'name_' . Yii::app()->language, 'sortable' => false), array('class' => 'bootstrap.widgets.TbButtonColumn', 'template' => '{up}{down}{fast_up}{fast_down}{update}{delete}', 'deleteConfirmation' => tc('Are you sure you want to delete this item?'), 'htmlOptions' => array('class' => 'infopages_buttons_column', 'style' => 'width:160px;'), 'buttons' => array('up' => array('label' => tc('Move an item up'), 'imageUrl' => $url = Yii::app()->assetManager->publish(Yii::getPathOfAlias('zii.widgets.assets.gridview') . '/up.gif'), 'url' => 'Yii::app()->createUrl("/location/backend/city/move", array("id"=>$data->id, "direction" => "up", "regionid"=>$data->region_id))', 'options' => array('class' => 'infopages_arrow_image_up'), 'visible' => '($data->sorter > "' . $model->minSorter . '") && ' . intval($model->region_id), 'click' => "js: function() { ajaxMoveRequest(\$(this).attr('href'), 'city-grid'); return false;}"), 'down' => array('label' => tc('Move an item down'), 'imageUrl' => $url = Yii::app()->assetManager->publish(Yii::getPathOfAlias('zii.widgets.assets.gridview') . '/down.gif'), 'url' => 'Yii::app()->createUrl("/location/backend/city/move", array("id"=>$data->id, "direction" => "down", "regionid"=>$data->region_id))', 'options' => array('class' => 'infopages_arrow_image_down'), 'visible' => '($data->sorter < "' . $model->maxSorter . '") && ' . intval($model->region_id), 'click' => "js: function() { ajaxMoveRequest(\$(this).attr('href'), 'city-grid'); return false;}"), 'fast_up' => array('label' => tc('Move to the beginning of the list'), 'imageUrl' => Yii::app()->theme->baseUrl . '/images/default/fast_top_arrow.gif', 'url' => 'Yii::app()->createUrl("/location/backend/city/move", array("id"=>$data->id, "direction" => "fast_up", "regionid"=>$data->region_id))', 'options' => array('class' => 'infopages_arrow_image_fast_up'), 'visible' => '($data->sorter > "' . $model->minSorter . '") && ' . intval($model->region_id), 'click' => "js: function() { ajaxMoveRequest(\$(this).attr('href'), 'city-grid'); return false;}"), 'fast_down' => array('label' => tc('Move to end of list'), 'imageUrl' => Yii::app()->theme->baseUrl . '/images/default/fast_bottom_arrow.gif', 'url' => 'Yii::app()->createUrl("/location/backend/city/move", array("id"=>$data->id, "direction" => "fast_down", "regionid"=>$data->region_id))', 'options' => array('class' => 'infopages_arrow_image_fast_down'), 'visible' => '($data->sorter < "' . $model->maxSorter . '") && ' . intval($model->region_id), 'click' => "js: function() { ajaxMoveRequest(\$(this).attr('href'), 'city-grid'); return false;}"))))));
$this->renderPartial('//site/admin-select-items', array('url' => '/location/backend/city/itemsSelected', 'id' => 'city-grid', 'model' => $model, 'options' => array('activate' => Yii::t('common', 'Activate'), 'deactivate' => Yii::t('common', 'Deactivate'), 'delete' => Yii::t('common', 'Delete'))));
?>
<?php
$csrf_token_name = Yii::app()->request->csrfTokenName;
$csrf_token = Yii::app()->request->csrfToken;
$cs = Yii::app()->getClientScript();
$cs->registerCoreScript('jquery.ui');
$str_js = "\n\t\tvar fixHelper = function(e, ui) {\n\t\t\tui.children().each(function() {\n\t\t\t\t\$(this).width(\$(this).width());\n\t\t\t});\n\t\t\treturn ui;\n\t\t};\n\n\t\tfunction reInstallSortable(id, data) {\n\t\t\tinstallSortable(\$(data).find('select[name=\"City[region_id]\"] option:selected').val());\n\t\t}\n\n\t\tfunction updateGrid() {\n\t\t\t\$.fn.yiiGridView.update('city-grid');\n\t\t}\n\n\t\tfunction installSortable(areaIdSel) {\n\t\t\tif (areaIdSel > 0) {\n\t\t\t\t\$('#city-grid table.items tbody').sortable({\n\t\t\t\t\tforcePlaceholderSize: true,\n\t\t\t\t\tforceHelperSize: true,\n\t\t\t\t\titems: 'tr',\n\t\t\t\t\tupdate : function () {\n\t\t\t\t\t\tserial = \$('#city-grid table.items tbody').sortable('serialize', {key: 'items[]', attribute: 'class'}) + '&{$csrf_token_name}={$csrf_token}&area_id=' + areaIdSel;\n\t\t\t\t\t\t\$.ajax({\n\t\t\t\t\t\t\t'url': '" . $this->createUrl('/location/backend/city/sortitems') . "',\n\t\t\t\t\t\t\t'type': 'post',\n\t\t\t\t\t\t\t'data': serial,\n\t\t\t\t\t\t\t'success': function(data){\n\t\t\t\t\t\t\t\tupdateGrid();\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t'error': function(request, status, error){\n\t\t\t\t\t\t\t\talert('We are unable to set the sort order at this time. Please try again in a few minutes.');\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t});\n\t\t\t\t\t},\n\t\t\t\t\thelper: fixHelper\n\t\t\t\t}).disableSelection();\n\t\t\t}\n\t\t}\n\n\t\tinstallSortable('" . intval($model->region_id) . "');\n";
$cs->registerScript('sortable-project', $str_js);