Exemplo n.º 1
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = AddressStreetType::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]);
     $query->andFilterWhere(['like', 's_name', $this->s_name])->andFilterWhere(['like', 'f_name', $this->f_name]);
     return $dataProvider;
 }
Exemplo n.º 2
0
 public function getAddressStreetType()
 {
     return $this->hasOne(AddressStreetType::className(), ['id' => 's_type_id']);
 }
 /**
  * Finds the AddressStreetType model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return AddressStreetType the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = AddressStreetType::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }
Exemplo n.º 4
0
?>
    <h1><?php 
echo Html::encode($this->title);
?>
</h1>

    <div class="row">
        <div class="col-md-12">
            <div class="panel panel-default">
                <div class="panel-heading">
                    <?php 
echo Html::a(Html::tag('i', '', ['class' => 'glyphicon glyphicon-plus']) . ' ' . Yii::t('app', 'Create Street'), ['create'], ['class' => 'btn btn-success']);
?>
                </div>
                <div class="panel-body">
                    <?php 
// echo $this->render('_search', ['model' => $searchModel]);
?>
                    <?php 
echo GridView::widget(['dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'columns' => ['id', 's_name', 's_type_id' => ['filter' => AddressStreetType::getAddressStreetTypeOptions(), 'attribute' => 's_type_id', 'value' => function (AddressStreet $data) {
    return $data->getSTypeId();
}], 'owner_id' => ['filter' => AddressCity::getAllOwnerIdOptions(), 'attribute' => 'owner_id', 'value' => function (AddressStreet $data) {
    return $data->getOwnerId();
}], ['class' => 'yii\\grid\\ActionColumn', 'contentOptions' => ['style' => 'width: 100px; text-align: center;']]]]);
?>
                </div>
            </div>
        </div>
    </div>
</div>
Exemplo n.º 5
0
echo $form->field($model, 's_name')->textInput(['maxlength' => true]);
?>
                        </div>
                    </div>
                    <div class="row">
                        <div class="col-md-6">
                            <?php 
$ownerIdOptions = $model->isNewRecord && !empty($model->owner_id) ? ['disabled' => 1] : [];
?>
                            <?php 
echo $form->field($model, 'owner_id')->dropDownList(AddressCity::getAllOwnerIdOptions(), ['prompt' => ''] + $ownerIdOptions);
?>
                        </div>
                        <div class="col-md-6">
                            <?php 
echo $form->field($model, 's_type_id')->dropDownList(AddressStreetType::getAddressStreetTypeOptions(), ['prompt' => '']);
?>
                        </div>
                    </div>
                </div>
                <div class="panel-footer">
                    <?php 
echo Html::submitButton($model->isNewRecord ? Yii::t('app', 'Create') : Yii::t('app', 'Update'), ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']);
?>
                </div>
            </div>
        </div>
    </div>
    <?php 
ActiveForm::end();
?>