public function up()
 {
     $cities = (include Yii::getAlias('@common') . '/data/city-list.php');
     foreach ($cities as $name) {
         $city = new City();
         $city->name = $name;
         $city->save();
     }
 }
예제 #2
0
파일: Region.php 프로젝트: deviardn/diadoo
 public function beforeDelete()
 {
     if (parent::beforeDelete()) {
         City::deleteAll('region_id = ' . $this->id);
         return true;
     } else {
         return false;
     }
 }
예제 #3
0
 public function search($params)
 {
     $query = City::find();
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     $query->andFilterWhere([City::tableName() . '.status' => '1']);
     if (!($this->load($params) && $this->validate())) {
         return $dataProvider;
     }
     $query->andFilterWhere(['Id' => $this->Id, 'stateId' => $this->stateId, 'cityStdCode' => $this->cityStdCode, 'createdOn' => $this->createdOn, 'status' => $this->status, 'isFg' => $this->isFg, 'priority' => $this->priority, 'parentCityId' => $this->parentCityId, 'updatedOn' => $this->updatedOn, 'createdBy' => $this->createdBy, 'updatedBy' => $this->updatedBy]);
     $query->andFilterWhere(['like', 'name', $this->name])->andFilterWhere(['like', 'alias', $this->alias])->andFilterWhere(['like', 'ip', $this->ip]);
     return $dataProvider;
 }
예제 #4
0
 public function actionGetcity($id)
 {
     $rows = \common\models\City::find()->where(['region_id' => $id, 'is_status' => 1])->all();
     echo "<option value=''>" . Yii::t('app', '-- Select City --') . "</option>";
     if (count($rows) > 0) {
         foreach ($rows as $row) {
             echo "<option value='{$row->id}'>{$row->city}</option>";
         }
     } else {
         echo "";
     }
 }
예제 #5
0
 /**
  * 获得城市名称
  * @return string
  */
 public static function getCityNameById($id)
 {
     $cityLists = \Yii::$app->cache->get('cache_city');
     if (!$cityLists) {
         $city = City::find()->where('1=1')->orderBy('id asc')->all();
         foreach ($city as $one) {
             $cityLists[$one->cityID] = $one->city;
         }
         \Yii::$app->cache->set('cache_city', $cityLists);
     }
     return $cityLists[$id];
 }
예제 #6
0
 /**
  * 初始化与系统地址有关的文件缓冲
  */
 public static function initSysaddress()
 {
     $sysaddress = array();
     //配置ID与地区匹配缓冲
     $province = Province::find()->where('1=1')->orderBy('id asc')->all();
     $city = City::find()->where('1=1')->orderBy('father asc,id asc')->all();
     $area = Area::find()->where('1=1')->orderBy('father asc,id asc')->all();
     foreach ($province as $value) {
         $sysaddress['province'][$value->provinceID] = $value->province;
     }
     foreach ($city as $value) {
         $sysaddress['city'][$value->cityID] = $value->city;
     }
     foreach ($area as $value) {
         $sysaddress['area'][$value->areaID] = $value->area;
     }
     //配置多级联动操作相关缓冲
     $sysaddress['province_option'] = '';
     foreach ($province as $value) {
         $sysaddress['province_option'] .= '<option value="' . $value->provinceID . '">' . $value->province . '</option>';
     }
     $sysaddress['province_option'] = '<select name="province" class="qys_common_provice contactField requiredField">' . $sysaddress['province_option'] . '</select>';
     #获得所有城市列表并按照省份排序
     #先从缓冲获得数据
     $i = 0;
     $city_list_fit = '';
     foreach ($city as $value) {
         if ($value->father !== $i) {
             $city_list_fit .= '</select><select name="city" class="qys_common_city_' . $value->father . ' contactField requiredField">';
             $i = $value->father;
         }
         $city_list_fit .= '<option value="' . $value->cityID . '">' . $value->city . '</option>';
     }
     $city_list_fit .= '</select>';
     $city_list_fit = substr($city_list_fit, 9);
     $sysaddress['city_option'] = $city_list_fit;
     #获得所有城市列表并按照省份排序
     #先从缓冲获得数据
     $i = 0;
     $area_list_fit = '';
     foreach ($area as $value) {
         if ($value->father !== $i) {
             $area_list_fit .= '</select><select name="area" class="qys_common_area_' . $value->father . ' contactField requiredField">';
             $i = $value->father;
         }
         $area_list_fit .= '<option value="' . $value->areaID . '">' . $value->area . '</option>';
     }
     $area_list_fit .= '</select>';
     $area_list_fit = substr($area_list_fit, 9);
     $sysaddress['area_option'] = $area_list_fit;
     \Yii::$app->cache->set('sys_address', $sysaddress);
 }
예제 #7
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = City::find();
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     $this->load($params);
     if (!$this->validate()) {
         // uncomment the following line if you do not want to any records when validation fails
         // $query->where('0=1');
         return $dataProvider;
     }
     $query->andFilterWhere(['id' => $this->id]);
     $query->andFilterWhere(['like', 'title_az', $this->title_az])->andFilterWhere(['like', 'title_ru', $this->title_ru])->andFilterWhere(['like', 'title_en', $this->title_en]);
     return $dataProvider;
 }
예제 #8
0
파일: CitySearch.php 프로젝트: kurmidev/ims
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = City::find();
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     $this->load($params);
     if (!$this->validate()) {
         // uncomment the following line if you do not want to return any records when validation fails
         // $query->where('0=1');
         return $dataProvider;
     }
     $query->andFilterWhere(['id' => $this->id, 'status' => $this->status, 'addedon' => $this->addedon, 'addedby' => $this->addedby, 'modifiedon' => $this->modifiedon, 'modifiedby' => $this->modifiedby]);
     $query->andFilterWhere(['like', 'city', $this->city])->andFilterWhere(['like', 'code', $this->code]);
     return $dataProvider;
 }
예제 #9
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = City::find();
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     $this->load($params);
     if (!$this->validate()) {
         // uncomment the following line if you do not want to return any records when validation fails
         // $query->where('0=1');
         return $dataProvider;
     }
     $query->andFilterWhere(['id' => $this->id, 'region_id' => $this->region_id, 'country_id' => $this->country_id, 'create_at' => $this->create_at, 'update_at' => $this->update_at, 'is_status' => $this->is_status]);
     $query->andFilterWhere(['like', 'city', $this->city]);
     return $dataProvider;
 }
예제 #10
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = City::find()->notDeleted()->with(['country']);
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     $this->load($params);
     if (!$this->validate()) {
         // uncomment the following line if you do not want to any records when validation fails
         // $query->where('0=1');
         return $dataProvider;
     }
     $query->andFilterWhere(['id' => $this->id, 'country_id' => $this->country_id, 'created_at' => $this->created_at, 'created_by' => $this->created_by, 'updated_at' => $this->updated_at, 'updated_by' => $this->updated_by, 'deleted' => $this->deleted]);
     $query->andFilterWhere(['like', 'name', $this->name]);
     return $dataProvider;
 }
예제 #11
0
 /**
  * Creating model search query.
  * @return ActiveDataProvider|\yii\data\DataProviderInterface
  */
 public function search($params = [])
 {
     $query = City::find();
     $dataProvider = new \roman444uk\yii\data\ActiveDataProvider(['query' => $query, 'pagination' => ['pageSize' => \roman444uk\yii\widgets\WidgetPageSize::getPageSize()]]);
     if ($params && !($this->load($params) && $this->validate())) {
         return $dataProvider;
     }
     if (!empty($params['name'])) {
         $ids = [];
         foreach ((new \yii\sphinx\Query())->from(self::tableName())->match($params['content'])->all() as $row) {
             array_push($ids, $row['id']);
         }
         $query->andWhere([self::tableName() . '.id' => $ids]);
     }
     $query->orderBy(self::tableName() . '.created_at desc');
     return $dataProvider;
 }
예제 #12
0
 public function actionCity()
 {
     $this->stdout('Request API: Cities.', Console::FG_GREEN);
     $data = TravelPayoutsApi::getCities();
     $_count = count($data);
     $this->stdout(' Get: ' . $_count . ' Cities.' . PHP_EOL, Console::FG_GREEN);
     Console::startProgress(0, $_count);
     $count = 0;
     $count_ = 0;
     foreach ($data as $value) {
         $value->lon = !empty($value->coordinates->lon) ? (string) $value->coordinates->lon : '';
         $value->lat = !empty($value->coordinates->lat) ? (string) $value->coordinates->lat : '';
         $name_translations = $value->name_translations;
         unset($value->name_translations);
         unset($value->coordinates);
         $city = City::find()->where(['code' => $value->code])->one();
         if (!$city) {
             $this->stdout($value->code . ' ', Console::FG_YELLOW);
             $city = new City();
             $city->attributes = (array) $value;
             $local = ['en-GB', 'en-AU', 'en-CA', 'en-NZ', 'en-IE', 'en-SG', 'en-IN'];
             foreach ($name_translations as $_key => $_name) {
                 if (array_search($_key, $local) === false) {
                     $city['name_' . $_key] = trim($_name);
                 }
             }
             if (!$city->save()) {
                 print_r($value);
                 print_r($city->errors);
                 return Controller::EXIT_CODE_ERROR;
             }
             $count++;
         } else {
             Console::updateProgress(++$count_, $_count);
         }
     }
     Console::endProgress();
     $this->stdout(PHP_EOL . 'Added: ' . $count . ' Cities.' . PHP_EOL, Console::FG_BLUE);
     return Controller::EXIT_CODE_NORMAL;
 }
예제 #13
0
                    $( "select#found-cat_3" ).html( data );
                });']);
?>
    <?php 
echo $form->field($model, 'cat_3')->dropDownList(ArrayHelper::map(Cats::find()->all(), 'id', 'title_az'), ['prompt' => '', 'onchange' => '
                $.post( "/found/list/' . '"+$(this).val(), function( data ) {
                    $( "select#found-cat_id" ).html( data );
                });']);
?>

    <?php 
echo $form->field($model, 'cat_id')->dropDownList(ArrayHelper::map(Cats::find()->all(), 'id', 'title_az'), ['prompt' => '']);
?>

    <?php 
echo $form->field($model, 'city_id')->dropDownList(ArrayHelper::map(City::find()->all(), 'id', 'title_az'), ['prompt' => '']);
?>

    <?php 
echo $form->field($model, 'district_id')->dropDownList(ArrayHelper::map(District::find()->all(), 'id', 'title_az'), ['prompt' => '', 'onchange' => '
                $.post( "/lost/location/' . '"+$(this).val(), function( data ) {
                    $( "select#found-street_id" ).html( data );
                });']);
?>

    <?php 
echo $form->field($model, 'street_id')->dropDownList(ArrayHelper::map(Street::find()->all(), 'id', 'title_az'), ['prompt' => '']);
?>

    <?php 
echo $form->field($model, 'metro_id')->dropDownList(ArrayHelper::map(Metro::find()->all(), 'id', 'title_az'), ['prompt' => '']);
예제 #14
0
                    </div>
                </div>
                
  <div class="panel panel-default">
    <div class="panel-heading" role="tab" id="headingTwo">
      <h4 class="panel-title">
        <a class="collapsed" role="button" data-toggle="collapse" data-parent="#accordion" href="#collapseTwo" aria-expanded="false" aria-controls="collapseTwo">
          Collapsible Group Item #2
        </a>
      </h4>
    </div>
    <div id="collapseTwo" class="panel-collapse collapse" role="tabpanel" aria-labelledby="headingTwo">
        <div class="filter-content" id="lost" style="width: 80%;margin: auto;">
            <div class="select">
                            <?php 
echo $form->field($model, 'city_id')->dropDownList(ArrayHelper::map(City::find()->all(), 'id', 'title_az'), ['prompt' => Yii::t('yii', 'choosecity')])->label(false);
?>
                                <i class="fa fa-angle-down"></i>
                            </div>

                            <div class="select">
                            <?php 
echo $form->field($model, 'district_id')->dropDownList(ArrayHelper::map(District::find()->all(), 'id', 'title_az'), ['prompt' => Yii::t('yii', 'choosedistrict'), 'onchange' => '
                                    $.get( "/lost/location/' . '"+$(this).val(), function( data ) {
                                        $( "select#lost-street_id" ).html( data );
                                    });'])->label(false);
?>
                                <i class="fa fa-angle-down"></i>
                            </div>

                            <div class="select">
예제 #15
0
use yii\helpers\Url;
use yii\web\View;
use yii\widgets\MaskedInput;
use yii\widgets\Spaceless;
?>

<div id="create-advert">

    <!-- Advert form -->
    <?php 
$form = ActiveForm::begin(['id' => 'advert-form', 'enableClientValidation' => true, 'enableAjaxValidation' => true, 'validateOnBlur' => true, 'validationUrl' => Url::to(['validate', 'id' => $model->id]), 'fieldConfig' => ['template' => "{label}{input}"], 'clientEvents' => ['ajaxSubmitSuccess' => "function(data) {\n    \$('a[data-update], a[data-view]').magnificPopup('close');\n    return false;\n}"]]);
?>

        <div class="left">
            <?php 
echo $form->field($model, 'city_id')->dropDownList(City::getList(), ['name' => $directPopulating ? 'city_id' : null, 'label' => 'City', 'emptyItem' => Yii::t('app', 'Empty city option')]);
?>

            <?php 
echo $form->field($model, 'type', [])->dropDownList(Advert::getTypesDropDownList(), ['name' => $directPopulating ? 'type' : null, 'emptyItem' => Yii::t('app', 'Empty type option')]);
?>

            <?php 
echo $form->field($model, 'category')->dropDownList(Category::getDropdownList(), ['name' => $directPopulating ? 'category' : null, 'emptyItem' => Yii::t('app', 'Empty category option')]);
?>

            <?php 
echo $form->field($model, 'term', ['template' => '{label}{input}'])->datepicker(['name' => $directPopulating ? 'term' : null, 'datepicker' => ['dateFormat' => Yii::$app->formatter->dateFormat, 'clientOptions' => ['maxDate' => "+1m", 'minDate' => "+1d", 'monthNamesShort' => DatepickerHelper::monthNamesShort()]]]);
?>
            
            <div class="range">
예제 #16
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getCityTo()
 {
     return $this->hasOne(City::className(), ['code' => 'city_to_code']);
 }
예제 #17
0
?>
    
    <div class="row">
        
        <div class="col-sm-9">
            <?php 
$form->field($model, 'content')->textarea([]);
?>
            <?php 
echo $form->field($model, 'content')->textarea(['name' => $directPopulating ? 'content' : null, 'rows' => 25]);
?>
        </div>
    
        <div class="col-sm-3">
            <?php 
echo $form->field($model, 'city_id')->dropDownList(City::getList(), ['name' => $directPopulating ? 'city_id' : null, 'class' => 'form-control input-sm']);
?>

            <?php 
echo $form->field($model, 'type')->dropDownList(Advert::getTypesDropDownList(), ['name' => $directPopulating ? 'type' : null, 'class' => 'form-control input-sm']);
?>

            <?php 
echo $form->field($model, 'category')->dropDownList(Category::getDropdownList(), ['name' => $directPopulating ? 'category' : null, 'class' => 'form-control input-sm']);
?>

            <?php 
/*echo $form->field($model, 'term')->datepicker([
      'name' => ($directPopulating) ? 'term' : null,
      'datepicker' => [
          'language' => 'ru',
예제 #18
0
    }
    
    $mobile_form = '';
    if(is_array($model->venueMap) && count($model->venueMap)){
        foreach($model->venueMap as $mapmodel){
            $mobile_form .= $form->field($mapmodel->venueMap, 'mobile')->textInput(['maxlength' => 255,'name'=>$model->formName().'[mobile][]']);
        }
    }else{
       $mobile_form = $form->field($map, 'mobile')->textInput(['maxlength' => 255,'name'=>$model->formName().'[mobile][]']);
    }
    //*/
//echo "<pre>";
//
//
// var_dump($model);
echo Collapse::widget(['box' => true, 'items' => ['Basic Details' => ['content' => implode("\n", [$form->field($model, 'venueType')->dropDownList(ArrayHelper::merge(['' => 'Select'], ArrayHelper::map(\common\models\VenueType::find()->andWhere(['status' => 1])->All(), 'Id', 'name'))), $form->field($model, 'name')->textInput(['maxlength' => 255])]), 'contentOptions' => ['class' => 'in'], 'options' => ['class' => 'box-primary']], 'Contact Details' => ['content' => implode("\n", [$form->field($model, 'contactName')->textInput(['maxlength' => 255]), $form->field($model, 'email')->textInput(['maxlength' => 255]), is_array($model->venueMap) && count($model->venueMap) ? $form->field($model->venueMap[0], 'phone', ['selectors' => ['input' => '.multiphone']])->widget(DynamicField::className(), ['name' => $model->formName() . '[phone][]', 'options' => ['class' => 'multiphone', 'model' => $map, 'models' => $model->venueMap]]) : $form->field($map, 'phone', ['selectors' => ['input' => '.multiphone']])->widget(DynamicField::className(), ['name' => $model->formName() . '[phone][]', 'options' => ['class' => 'multiphone']]), is_array($model->venueMap) && count($model->venueMap) ? $form->field($model->venueMap[0], 'mobile', ['selectors' => ['input' => '.multimobile']])->widget(DynamicField::className(), ['name' => $model->formName() . '[mobile][]', 'options' => ['class' => 'multimobile', 'model' => $map, 'models' => $model->venueMap]]) : $form->field($map, 'mobile', ['selectors' => ['input' => '.multimobile']])->widget(DynamicField::className(), ['name' => $model->formName() . '[mobile][]', 'options' => ['class' => 'multimobile']]), $form->field($model, 'tollfree')->textInput(['maxlength' => 15])]), 'options' => ['class' => 'box-success']], 'Location Details' => ['content' => implode("\n", [$form->field($model, 'cityId')->dropDownList(ArrayHelper::merge(['' => 'Select'], ArrayHelper::map(\common\models\City::find()->andWhere(['status' => 1])->All(), 'Id', 'name'))), $form->field($model, 'zoneId')->widget(DepDrop::classname(), ['options' => ['id' => strtolower($model->formName()) . '-zoneid'], 'data' => ArrayHelper::merge(['' => 'Select'], ArrayHelper::map(\common\models\Zone::find()->andWhere(['status' => 1, 'cityId' => $model->cityId])->All(), 'Id', 'name')), 'type' => DepDrop::TYPE_SELECT2, 'pluginOptions' => ['depends' => [strtolower($model->formName()) . '-cityid'], 'placeholder' => 'Select Zone', 'url' => Url::to(['/zone/zone/autosuggest'])]]), $form->field($model, 'localityId')->widget(DepDrop::classname(), ['options' => ['id' => 'venue-localityid'], 'data' => ArrayHelper::merge(['' => 'Select'], ArrayHelper::map(\common\models\Locality::find()->andWhere(['status' => 1, 'cityId' => $model->cityId])->All(), 'Id', 'name')), 'type' => DepDrop::TYPE_SELECT2, 'pluginOptions' => ['depends' => [strtolower($model->formName()) . '-cityid', strtolower($model->formName()) . '-zoneid'], 'placeholder' => 'Select Locality', 'url' => Url::to(['/locality/locality/autosuggest'])]]), $form->field($model, 'address')->textInput(['maxlength' => 255]), $form->field($model, 'landmark')->textInput(['maxlength' => 255]), $form->field($model, 'gpsLat')->textInput(), $form->field($model, 'gpsLong')->textInput()]), 'options' => ['class' => 'box-danger']], 'More Details' => ['content' => implode("\n", [$form->field($model, 'description')->textarea(['rows' => 6]), $form->field($model, 'facility')->listBox(ArrayHelper::merge([0 => 'Select'], ArrayHelper::map(\common\models\Features::find()->andWhere(['status' => 1, 'flag' => 1])->All(), 'Id', 'name')), ['id' => 'facility', 'multiple' => 'multiple']), $form->field($model, 'url')->textInput(['maxlength' => 100, 'placeholder' => 'Type a valid url ex: http://timescity.com']), $form->field($model, 'facebookUrl')->textInput(['maxlength' => 100, 'placeholder' => 'Type a valid url ex: http://facebook.com']), $form->field($model, 'seatType')->textInput(['maxlength' => 100]), $form->field($model, 'capacity')->textInput(), $form->field($model, 'reservationInfo')->textInput(['maxlength' => 100]), $form->field($model, 'startTime')->textInput(), $form->field($model, 'endTime')->textInput(), $model->multipleFormField('tag', $model->getTagData())]), 'options' => ['class' => 'box-info']], 'Images' => ['content' => MediaUpload::widget(['data' => $model->media['images'], 'previewurl' => yii::$app->params['imagepreviewurl'], 'path' => 'venue', 'options' => ['addRemoveLinks' => true, 'inputparam' => $model->formName() . '[media][]']]), 'options' => ['class' => 'box-info']]]]);
echo WorkflowButtons::widget(['view' => $this, 'model' => $model]);
Column::end();
Row::end();
?>

    <?php 
/*/?>
    <?= $form->field($model, 'name')->textInput(['maxlength' => 255]) ?>

    <?= $form->field($model, 'cityId')->textInput() ?>

    <?= $form->field($model, 'zoneId')->textInput() ?>

    <?= $form->field($model, 'localityId')->textInput() ?>
예제 #19
0
 /**
  * Finds the City model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return City the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = City::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }
예제 #20
0
 * @var yii\web\View $this
 * @var common\models\EventSearch $model
 * @var yii\widgets\ActiveForm $form
 */
?>

<div class="event-search">

    <?php 
$form = ActiveForm::begin(['action' => ['index'], 'method' => 'get']);
?>

    <?php 
echo $form->field($model, 'Id');
echo $form->field($model, 'name');
echo $form->field($model, 'cityId')->dropDownList(ArrayHelper::merge(['' => 'Select'], ArrayHelper::map(\common\models\City::find()->andWhere(['status' => 1])->All(), 'Id', 'name')), ['id' => 'cityId']);
echo $form->field($model, 'state')->dropDownList(ArrayHelper::merge(['' => 'Select'], $model->StateNameArray()), ['id' => 'state']);
?>
    <?php 
// $form->field($model, 'venueId')
?>

    <?php 
//  $form->field($model, 'venueType')
?>

    <?php 
//$form->field($model, 'sourceId')
?>

    <?php 
예제 #21
0
 public function getCity()
 {
     return $this->hasOne(City::className(), ['Id' => 'cityId']);
 }
예제 #22
0
    public static function getCityCountTotalSql()
    {
        $param = self::CITY_COUNT_TOTAL;
        $cityTable = City::tableName();
        return $sql = <<<SQL
select '{$param}' as param, count(*) as value from {$cityTable} where active = 1
SQL;
        return null;
    }
예제 #23
0
/* @var $model common\models\BrandsCityMap */
/* @var $form yii\widgets\ActiveForm */
?>
<div class="brands-city-map-form">

    <?php 
$form = ActiveForm::begin(['validationUrl' => ['validate']]);
?>

    <?php 
echo $form->field($model, 'chainId', ['enableAjaxValidation' => true])->dropDownList(ArrayHelper::merge(['' => 'Select'], ArrayHelper::map(\common\models\Brands::find()->andWhere(['status' => 1])->orderBy('name')->All(), 'Id', 'name')));
?>
 

    <?php 
echo $form->field($model, 'cityId', ['enableAjaxValidation' => true])->dropDownList(ArrayHelper::merge(['' => 'Select'], ArrayHelper::map(\common\models\City::find()->andWhere(['status' => 1])->All(), 'Id', 'name')));
?>
 

    <?php 
echo $form->field($model, 'name')->textInput(['maxlength' => 225]);
?>
 

    <?php 
echo $form->field($modelBrandsCityField, 'name')->checkbox(['label' => 'Lock']);
?>

    <?php 
echo $form->field($model, 'website')->textInput(['maxlength' => 225]);
?>
예제 #24
0
파일: Country.php 프로젝트: BeforyDeath/tfa
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getCity()
 {
     return $this->hasMany(City::className(), ['country_code' => 'code']);
 }
예제 #25
0
파일: create.php 프로젝트: jedzura/nzs
<?php

/* @var $this yii\web\View */
/* @var $form yii\bootstrap\ActiveForm */
/* @var $model \common\models\Group */
use common\models\City;
use common\models\University;
use yii\helpers\ArrayHelper;
use yii\helpers\Html;
use yii\bootstrap\ActiveForm;
$this->title = Yii::t('lbl', 'Add your organization');
$cities = ArrayHelper::map(City::find()->orderBy('name')->all(), 'id', 'name');
$universities = [];
if ($model->city_id) {
    $universities = ArrayHelper::map(University::find()->where(['city_id' => $model->city_id])->all(), 'id', 'name');
}
$tags = '[]';
if ($model->tag) {
    $tags = $model->tag;
    $model->tag = null;
}
$this->registerJs("\n    \$('textarea.tags').textext({\n        plugins: 'tags',\n        tags: {\n            items: " . $tags . "\n        }\n    });");
?>
<div class="site-signup">
    <h1 class="text-center"><?php 
echo $this->title;
?>
</h1>
    <?php 
$form = ActiveForm::begin();
?>
예제 #26
0
 public function getCities($countryId)
 {
     $cityModel = City::model()->findAllByAttributes(array('countryID' => $countryId));
     if ($cityModel) {
         $cityList = CHtml::listData($cityModel, 'id', 'name');
         return $cityList;
     } else {
         return array();
     }
 }
예제 #27
0
파일: profile.php 프로젝트: deviardn/diadoo
$listDataRegion = yii\helpers\ArrayHelper::map(common\models\Region::find()->all(), 'id', 'region');
?>



                <?php 
echo $form->field($model, 'region_id')->dropDownList($listDataRegion, ['prompt' => '-- Select Region --', 'onchange' => '
                            $.get("' . yii\helpers\Url::toRoute(['dependent/getcity']) . '", { id: $(this).val() })
                                .done(function(data){
                                    $("#' . Html::getInputId($model, 'city_id') . '").html( data );
                                });']);
?>

                <!-- City -->
                <?php 
$listDataCity = \yii\helpers\ArrayHelper::map(\common\models\City::find()->all(), 'id', 'city');
?>

                <?php 
if (isset($model->city_id)) {
    echo $form->field($model, 'city_id')->dropDownList($listDataCity, ['prompt' => '-- Select City --']);
} else {
    echo $form->field($model, 'city_id')->dropDownList(['prompt' => Yii::t('app', '--- Select City ---')]);
}
?>

                <?php 
// echo $form->field($model, 'gravatar_email')->hint(\yii\helpers\Html::a(Yii::t('user', 'Change your avatar at Gravatar.com'), 'http://gravatar.com'))
?>

                <?php 
예제 #28
0
        </div>
        {items}
        <div class="row">
            <div class="col-sm-8">
                {pager}
            </div>
            <div class="col-sm-4 text-right" style="padding-top: 20px">
                ' . GridBulkActions::widget(['gridId' => 'user-grid']) . '
            </div>
        </div>', 'columns' => [['class' => 'yii\\grid\\CheckboxColumn', 'options' => ['style' => 'width:10px']], ['class' => 'yii\\grid\\SerialColumn', 'options' => ['style' => 'width:10px']], ['attribute' => 'id', 'header' => '№', 'filterInputOptions' => ['class' => 'form-control input-sm']], ['attribute' => 'content', 'format' => 'raw', 'contentOptions' => ['style' => 'text-align: left'], 'filterInputOptions' => ['class' => 'form-control input-sm']], ['class' => 'roman444uk\\yii\\grid\\AjaxUpdateColumn', 'attribute' => 'status', 'fieldType' => AjaxUpdateColumn::FIELD_TYPE_DROPDOWN, 'fieldOptions' => ['class' => 'form-control input-sm', 'items' => Advert::getTranslatedStatusList()], 'filter' => Advert::getTranslatedStatusList(), 'filterInputOptions' => ['class' => 'form-control input-sm'], 'updateUrl' => function ($model, $key, $index) {
    return Yii::$app->urlManager->createUrl(['advert/update', 'id' => $key]);
}, 'errorUpdate' => new JsExpression("function() {\n                alert('error updating');\n            }")], ['class' => 'roman444uk\\yii\\grid\\AjaxUpdateColumn', 'attribute' => 'category', 'fieldType' => AjaxUpdateColumn::FIELD_TYPE_DROPDOWN, 'fieldOptions' => ['class' => 'form-control input-sm', 'items' => Category::getDropdownList()], 'filter' => Category::getDropdownList(), 'filterInputOptions' => ['class' => 'form-control input-sm'], 'updateUrl' => function ($model, $key, $index) {
    return Yii::$app->urlManager->createUrl(['advert/update', 'id' => $key]);
}, 'errorUpdate' => new JsExpression("function() {\n                alert('error updating');\n            }")], ['attribute' => 'city_id', 'header' => 'Город', 'value' => function ($model, $key, $index) {
    return $model->cityName;
}, 'filter' => City::getList(), 'filterInputOptions' => ['class' => 'form-control input-sm'], 'format' => 'raw'], ['class' => 'yii\\grid\\DataColumn', 'attribute' => 'created_at', 'header' => 'Добавлено', 'format' => 'datetime', 'filter' => City::getList(), 'filterInputOptions' => ['class' => 'form-control input-sm']], ['class' => 'yii\\grid\\DataColumn', 'attribute' => 'updated_at', 'header' => 'Обновлено', 'format' => 'datetime', 'filter' => City::getList(), 'filterInputOptions' => ['class' => 'form-control input-sm']], ['class' => 'roman444uk\\yii\\grid\\StatusColumn', 'attribute' => 'published', 'filterInputOptions' => ['class' => 'form-control input-sm']], ['class' => 'roman444uk\\yii\\grid\\StatusColumn', 'attribute' => 'is_foreign', 'header' => 'Из сервиса', 'filter' => ['Да', 'Нет'], 'filterInputOptions' => ['class' => 'form-control input-sm']], ['class' => 'roman444uk\\yii\\grid\\ViewColumn', 'view' => '@backend/views/advert/_advert_grid_column', 'options' => ['style' => 'width:70px']], ['class' => 'yii\\grid\\ActionColumn', 'contentOptions' => ['style' => 'width:30px; text-align:center;'], 'buttons' => ['view' => function ($url, $model, $key) {
    return Html::a('<span class="glyphicon glyphicon-eye-open"></span><br>', $url, ['title' => Yii::t('yii', 'View'), 'data-pjax' => 0, 'data-view' => $key]);
}, 'update' => function ($url, $model, $key) {
    return Html::a('<span class="glyphicon glyphicon-pencil"></span><br>', $url, ['title' => Yii::t('yii', 'Update'), 'data-pjax' => 0, 'data-update' => $key]);
}]]]]);
?>

<?php 
Pjax::end();
?>

<?php 
echo MagnificPopup::widget(['id' => '', 'type' => 'ajax', 'target' => '#advert-grid-create-button, a[data-update], a[data-view]', 'options' => ['removalDelay' => 300, 'callbacks' => ['parseAjax' => new JsExpression('function(mfpResponse) {
    console.log("Ajax content loaded:", mfpResponse);
    }'), 'ajaxContentAdded' => new JsExpression('function() {
    console.log(this.content);