Exemplo n.º 1
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = NearestCities::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', 'city', $this->city]);
     return $dataProvider;
 }
Exemplo n.º 2
0
 /**
  * Finds the NearestCities model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return NearestCities the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = NearestCities::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }
Exemplo n.º 3
0
echo $form->field($incident, 'address')->textInput(['maxlength' => true]);
?>
            <?php 
echo $form->field($incident, 'city')->textInput(['maxlength' => true]);
?>
            <?php 
echo $form->field($incident, 'state')->textInput(['maxlength' => true]);
?>
            <?php 
echo $form->field($incident, 'zip')->textInput(['maxlength' => true]);
?>
            <?php 
echo $form->field($incident, 'county')->textInput(['maxlength' => true]);
?>
            <?php 
echo $form->field($incident, 'nearest_city_id')->dropDownList(NearestCities::nearestCitiesDropdown(), ['prompt' => '']);
?>
        </div>
        <div class="col-md-4 col-md-offset-2">
            <?php 
echo $form->field($incident, 'lat')->textInput();
?>
            <?php 
echo $form->field($incident, 'lon')->textInput();
?>
        </div>
    </div>
    <hr />
    <h3>Injury Information</h3>
    <br />
    <div class="row">
Exemplo n.º 4
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getNearestCities()
 {
     return $this->hasOne(NearestCities::className(), ['id' => 'nearest_city_id']);
 }