public function run() { $country = Country::model()->findAll(['order' => 'country_order']); $region = Regions::model()->findAllByAttributes(['id_country' => $this->model['countries']]); $city = City::model()->findAllByAttributes(['id_region' => $this->model['region']]); $this->render('main', ['model' => $this->model, 'title' => $this->title, 'prefix_name' => $this->prefixName, 'country' => $country, 'region' => $region, 'city' => $city]); }
/** * Returns the data model based on the primary key given in the GET variable. * If the data model is not found, an HTTP exception will be raised. * @param integer $id the ID of the model to be loaded * @return Regions the loaded model * @throws CHttpException */ public function loadModel($id) { $model = Regions::model()->findByPk($id); if ($model === null) { throw new CHttpException(404, 'The requested page does not exist.'); } return $model; }
public function actionResidence() { if (!Yii::app()->request->isAjaxRequest) { throw new CHttpException('403'); } if ($_POST) { $id = (int) $_POST['id']; $this_model = $_POST["who_this"]; $who_model = $_POST['who_model']; $prefix = $_POST['prefix']; $model = !empty($_POST['model']) && class_exists($_POST['model']) ? new $_POST['model']() : ''; $data = []; $empty = ''; $js_param_two = 'region'; if ($who_model == 'region') { $js_param_two = 'city'; $regions = Regions::model()->findAllByAttributes(['id_' . $this_model => $id]); $data = CHtml::listData($regions, 'id_region', 'region_name_ru'); $empty = 'Select region'; } elseif ($who_model == 'city') { $js_param_two = ''; $cities = City::model()->findAllByAttributes(['id_' . $this_model => $id]); $data = CHtml::listData($cities, 'id_city', 'city_name_ru'); $empty = 'Select city'; } $url = $this->createUrl('/residence/residence/residence'); $name = $who_model; if ($model && $model instanceof CActiveRecord && isset($model->{$who_model})) { $name = CHtml::activeName($model, $who_model); } elseif ($prefix) { $name = $prefix . "[{$who_model}]"; } if ($model && $model instanceof CActiveRecord && isset($model->{$who_model})) { $label = $model->getAttributeLabel($who_model); } else { $label = Yii::t('choose-city', $who_model); } $this->renderPartial('residence.views.widget._select_block', ['attribute' => $who_model, 'label' => $label, 'name' => $name, 'data' => $data, 'onChange' => "showCities{$prefix}(\$(this),'{$js_param_two}','{$who_model}','{$url}')", 'empty' => $empty]); } }
<?php $form = $this->beginWidget('CActiveForm', array('id' => 'members-form', 'enableAjaxValidation' => false)); ?> <p class="note">Fields with <span class="required">*</span> are required.</p> <?php echo $form->errorSummary($model); ?> <div class="row"> <?php echo $form->labelEx($model, 'regionID'); ?> <?php echo CHtml::activeDropDownList($model, 'regionID', Chtml::listData(Regions::model()->findAll(), 'regionID', 'regionName'), array('empty' => 'Select a Region')); ?> <?php echo $form->error($model, 'regionID'); ?> </div> <div class="row"> <?php echo $form->labelEx($model, 'membershipTypeID'); ?> <?php echo CHtml::activeDropDownList($model, 'membershipTypeID', Chtml::listData(MembershipTypes::model()->findAll(), 'membershipTypeID', 'membershipTypeName'), array('empty' => 'Select Membership Type')); ?> <?php echo $form->error($model, 'membershipTypeID');
echo $getTranslateWorld['services']; ?> </h1> --> </div><!--/.box--> </div><!--/.container--> </section><!--/#services--> <section id="about-armenia"> <div class="container"> <div class="box"> <h1><?php echo $getTranslateWorld['about_armenia']; ?> </h1> <div class="row"> <?php $regions = Regions::model()->findAllByAttributes(array('language' => $language)); if (!empty($regions)) { foreach ($regions as $key => $value) { ?> <div class="col-md-4 col-sm-6"> <div class="center"> <a href="#myModal" role="button" data-toggle="modal" class="thumbnail"> <img id = "<?php echo $value->id; ?> " data-image = "<?php echo Yii::app()->request->baseUrl . '/css/xeon/images/gallery/' . $value->image; ?> " data-title="<?php echo $value->title; ?>
<?php /* @var $this BbController */ /* @var $model Bb */ /* @var $form CActiveForm */ ?> <?php Yii::app()->clientScript->registerScriptFile(Yii::app()->assetManager->publish('js/admin.js'), CClientScript::POS_HEAD); Yii::app()->clientScript->registerCssFile(Yii::app()->request->baseUrl . '/css/admin.css'); $this->beginWidget('zii.widgets.jui.CJuiDialog', array('id' => 'nextdialog', 'options' => array('title' => 'Выбрать позицию', 'modal' => 'true', 'width' => '420px', 'autoOpen' => false))); echo "<div id='nextdisplay'></div>"; $this->endWidget('zii.widgets.jui.CJuiDialog'); echo "\n\n"; $this->beginWidget('zii.widgets.jui.CJuiDialog', array('id' => 'mydialog', 'options' => array('title' => 'Выбрать регион', 'modal' => 'true', 'autoOpen' => false))); /**/ $this->widget('ext.accWidget', array('model' => Regions::model(), 'columns' => array(array('', 'name')), 'id' => 'id', 'togo' => 'prods/group', 'next' => 'next', 'par' => 'region_id', 'action' => 'select_id(this,"Bb_region_id","regname","mydialog")', 'active' => $model->region['id'], 'class' => 'topnav', 'level' => 2)); $this->endWidget('zii.widgets.jui.CJuiDialog'); /**/ ?> <div class="form"> <?php $form = $this->beginWidget('CActiveForm', array('id' => 'bb-form', 'enableAjaxValidation' => false)); ?> <p class="note">Fields with <span class="required">*</span> are required.</p> <?php echo $form->errorSummary($model); ?> <div class="row">
<div class="box-header"> <h3 class="box-title"> <?php echo Yii::t('main', 'Основные настройки'); ?> </h3> </div> <div class="box-body"> <div class="form-group"> <?php echo $form->labelEx($model, 'region_id'); ?> <?php echo $form->dropDownList($model, 'region_id', CHtml::listData(Regions::model()->findAll(), 'id', 'title_ru'), array('class' => 'form-control', 'empty' => 'Выберите регион')); ?> <?php echo $form->error($model, 'region_id'); ?> </div> <div class="form-group"> <?php echo $form->labelEx($model, 'description_ru'); ?> <?php $this->widget('application.extensions.eckeditor.ECKEditor', array('model' => $model, 'attribute' => 'description_ru', 'config' => array('filebrowserUploadUrl' => $this->createUrl('/admin/upload/index/')))); ?> <?php
<?php /* @var $this SiteController */ $breadcrumbs = array(); if (isset($_GET['region_id'])) { $region = Regions::model()->findByPk($_GET['region_id']); $breadcrumbs = array(Yii::t('main', 'Регионы') => array('site/regions'), Yii::app()->language == 'ru' ? $region->title_ru : $region->title_uk); $title = Yii::app()->language == 'ru' ? $region->title_ru : $region->title_uk; } elseif (isset($_GET['find'])) { $breadcrumbs = array(Yii::t('main', 'Результаты поиска')); $title = Yii::t('main', 'Поиск'); } else { $breadcrumbs = array(Yii::t('main', 'Новости')); $title = Yii::t('main', 'Новости'); } $this->pageTitle = Yii::app()->name; ?> <div class="party-border"></div> <section class="party-extension-main -flex"> <div class="party-video-photo-field"> <?php $this->widget('zii.widgets.CBreadcrumbs', array('links' => $breadcrumbs, 'htmlOptions' => array('class' => 'party-breadcrumps'), 'separator' => '▪')); ?> <h1><?php echo $title; ?> </h1> <?php $this->widget('zii.widgets.CListView', array('dataProvider' => $data, 'ajaxUpdate' => false, 'itemView' => '_news', 'template' => '<div class="party-outer-all-miltimedia">{items}</div>{pager}', 'cssFile' => false, 'pager' => array('maxButtonCount' => 5, 'lastPageLabel' => null, 'nextPageLabel' => Yii::t('main', 'Вперед'), 'prevPageLabel' => Yii::t('main', 'Назад'), 'firstPageLabel' => null, 'class' => 'CLinkPager', 'header' => false, 'cssFile' => false, 'htmlOptions' => array('class' => ''), 'selectedPageCssClass' => 'party-active-pagination', 'firstPageCssClass' => 'party-prev-pagination', 'lastPageCssClass' => 'party-prev-pagination', 'previousPageCssClass' => 'party-prev-pagination', 'nextPageCssClass' => 'party-prev-pagination'), 'pagerCssClass' => 'party-pagination', 'sortableAttributes' => array('rating', 'create_time'), 'itemsCssClass' => 'clear')); ?> </div>
echo $form->labelEx($model, 'state'); ?> <?php echo $form->textField($model, 'state', array('size' => 2, 'maxlength' => 2)); ?> <?php echo $form->error($model, 'state'); ?> </div> <div class="row"> <?php echo $form->labelEx($model, 'favorite_region_id'); ?> <?php $region_list = CHtml::listData(Regions::model()->findAll(array('order' => 'region_name ASC')), 'id', 'region_name'); ?> <?php echo $form->dropDownList($model, 'favorite_region_id', $region_list, array('empty' => '(Select an Region)')); ?> <?php echo $form->error($model, 'favorite_region_id'); ?> </div> <div class="row"> <?php echo $form->labelEx($model, 'user_role'); ?> <?php echo $form->dropDownList($model, 'user_role', Yii::app()->params['user_roles']);
<div class="row"> <?php echo $form->labelEx($model, 'country'); ?> <?php echo $form->textField($model, 'country', array('size' => 45, 'maxlength' => 45)); ?> <?php echo $form->error($model, 'country'); ?> </div> <div class="row"> <?php echo $form->labelEx($model, 'region_id'); $region_list = CHtml::listData(Regions::model()->findAll(array('order' => 'country ASC, region_name ASC')), 'id', 'countryRegion'); echo $form->dropDownList($model, 'id', $region_list, array('empty' => '(Select an Region)')); echo $form->error($model, 'region_id'); ?> </div> <div class="row"> <?php echo $form->labelEx($model, 'appellation'); ?> <?php echo $form->textField($model, 'appellation', array('size' => 45, 'maxlength' => 45)); ?> <?php echo $form->error($model, 'appellation'); ?>
?> </h1> <div class="form"> <?php $set = Regions::model()->findAll(); echo "<ul>"; for ($ii = 0; sizeof($set) > $ii; $ii++) { echo "<li>" . $set[$ii]['id'] . " " . $set[$ii]['name'] . "=>" . $set[$ii]['region_id'] . "->" . $set[$ii]['next'] . "</li>"; } echo "</ul>"; ?> </div> <p> <div class="form"> <?php $category = Regions::model()->findByPk(0); /* $set=$category->descendants()->findAll(); echo "<ul>"; for($ii=0;sizeof($set)>$ii;$ii++) { echo "<li>".$set[$ii]['id']." ".$set[$ii]['name']."=>".$set[$ii]['region_id']."->".$set[$ii]['next']."</li>"; } echo "</ul>"; */ ?> </div> <h2><?php echo "return: " . Yii::app()->user->returnUrl; ?> </h2> <h2><?php
echo $form->labelEx($model, 'state'); ?> <?php echo $form->textField($model, 'state', array('size' => 2, 'maxlength' => 2)); ?> <?php echo $form->error($model, 'state'); ?> </div> <div class="row"> <?php echo $form->labelEx($model, 'favorite_region_id'); ?> <?php $region_list = CHtml::listData(Regions::model()->findAll(), 'id', 'region_name'); ?> <?php echo $form->dropDownList($model, 'favorite_region_id', $region_list, array('empty' => '(Select an Region)')); ?> <?php echo $form->error($model, 'favorite_region_id'); ?> </div> <div class="row"> <?php echo $form->labelEx($model, 'profile'); ?> <?php echo $form->textArea($model, 'profile', array('rows' => 6, 'cols' => 50));
public function actionGetRegion() { if (isset($_POST['id'])) { $region = Regions::model()->findByPk($_POST['id']); $this->renderPartial('regionBottom', array('region' => $region)); } }