Ejemplo n.º 1
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = RgnCountry::find();
     $dataProvider = new ActiveDataProvider(['query' => $query, 'pagination' => ['pageSize' => 50]]);
     $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', 'status', $this->status])->andFilterWhere(['like', 'name', $this->name])->andFilterWhere(['like', 'abbreviation', $this->abbreviation]);
     return $dataProvider;
 }
Ejemplo n.º 2
0
echo $form->field($model, 'id')->textInput(['disabled' => 'disabled', 'placeholder' => 'autonumber']);
?>
					<?php 
echo $form->field($model, 'number')->textInput(['maxlength' => true]);
?>
					<?php 
echo $form->field($model, 'name')->textInput(['maxlength' => true]);
?>
					<?php 
echo $form->field($model, 'city_id')->widget(DepDrop::classname(), ['data' => [], 'type' => DepDrop::TYPE_SELECT2, 'select2Options' => ['pluginOptions' => ['multiple' => FALSE, 'allowClear' => TRUE, 'tags' => TRUE, 'maximumInputLength' => 255]], 'pluginOptions' => ['initialize' => TRUE, 'placeholder' => 'Select or type city', 'depends' => ['rgndistrictform-province_id'], 'url' => Url::to(['/rgn-city/depdrop-options', 'selected' => $model->city_id]), 'loadingText' => 'Loading cities ...']]);
?>
					<?php 
echo $form->field($model, 'province_id')->widget(DepDrop::classname(), ['data' => [], 'type' => DepDrop::TYPE_SELECT2, 'select2Options' => ['pluginOptions' => ['multiple' => FALSE, 'allowClear' => TRUE, 'tags' => TRUE, 'maximumInputLength' => 255]], 'pluginOptions' => ['initialize' => TRUE, 'placeholder' => 'Select or type province', 'depends' => ['rgndistrictform-country_id'], 'url' => Url::to(['/rgn-province/depdrop-options', 'selected' => $model->province_id]), 'loadingText' => 'Loading provinces ...']]);
?>
					<?php 
echo $form->field($model, 'country_id')->widget(Select2::classname(), ['data' => RgnCountry::asOption(), 'pluginOptions' => ['placeholder' => 'Select or type Country', 'multiple' => FALSE, 'allowClear' => TRUE, 'tags' => TRUE, 'maximumInputLength' => 255]]);
?>
                </p>

				<?php 
$this->endBlock();
?>

				<?php 
echo Tabs::widget(['encodeLabels' => false, 'items' => [['label' => 'RgnDistrict', 'content' => $this->blocks['main'], 'active' => true]]]);
?>
                <hr/>
				<?php 
echo $form->errorSummary($model);
?>
				<?php 
 /**
  * Finds the RgnCountry model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return RgnCountry the loaded model
  * @throws HttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = RgnCountry::findOne($id)) !== null) {
         return $model;
     } else {
         throw new HttpException(404, 'The requested page does not exist.');
     }
 }
Ejemplo n.º 4
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getCountry()
 {
     return $this->hasOne(RgnCountry::className(), ['id' => 'country_id']);
 }
Ejemplo n.º 5
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getCountry()
 {
     return $this->hasOne(\frontend\models\RgnCountry::className(), ['id' => 'country_id']);
 }