public function actionView_user() { $user = new User(); /*$user->find()->where(['vk_id' => Cookie::get('vk_id')])->one();*/ $viewUser = $user->find()->where(['id' => $_GET['id']])->one(); $region = new GeobaseRegion(); $city = new GeobaseCity(); $regionUser = $region->find()->where(['id' => $viewUser['region_id']])->one(); $cytiUser = $city->find()->where(['id' => $user->city_id])->one(); $this->app->parser->render('view_user', ['viewUser' => $viewUser, 'regionUser' => $regionUser, 'cityUser' => $cytiUser], true); }
public function actionGet_city() { $city = new GeobaseCity(); $cityAll = $city->find()->where(['region_id' => $_POST['regionId']])->orderBy('name', 'ASC')->all(); echo Forms::dropDownList('city_id', null, ArrayHelper::map($cityAll, 'id', 'name'), ['class' => 'searchCity form-control', 'prompt' => 'Выберите город']); }
<?php echo Forms::checkboxList('services', $selectServ, ArrayHelper::map($services, 'id', 'name')); ?> <?php } ?> <p class="bg-danger">Выберите свое месторасположение</p> <div><span>Регион:</span> <?php echo Forms::dropDownList('region_id', $user->region_id, ArrayHelper::map($regionAll, 'id', 'name'), ['class' => 'region form-control', 'prompt' => 'Выберите регион']); ?> </div> <div class="city"> <?php if (isset($user->region_id)) { $city = new GeobaseCity(); $cityAll = $city->find()->where(['region_id' => $user->region_id])->orderBy('name', 'ASC')->all(); //\lib\helpers\Debug::prn($user->regionId); echo "<span>Город:</span>"; echo Forms::dropDownList('city_id', $user->city_id, ArrayHelper::map($cityAll, 'id', 'name'), ['class' => 'form-control']); } ?> </div> <?php echo Forms::input('submit', 'saveProfile', 'Сохранить', ['class' => 'btn btn-success']); echo Forms::end(); ?>