Beispiel #1
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Rebanho::find();
     $query->joinWith('relIdNucleo');
     // add conditions that should always apply here
     $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;
     }
     // grid filtering conditions
     $query->andFilterWhere(['idRebanho' => $this->idRebanho]);
     $query->andFilterWhere(['like', 'designacao', $this->designacao])->andFilterWhere(['like', 'Nucleo.nome', $this->idNucleo]);
     return $dataProvider;
 }
Beispiel #2
0
?>

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

    <?php 
echo $form->field($model, 'idEspecie')->dropDownList(ArrayHelper::map(Especie::find()->all(), 'idEspecie', 'designacao'), ['prompt' => 'Escolher Espécie']);
?>

    <?php 
echo $form->field($model, 'idRaca')->dropDownList(ArrayHelper::map(Raca::find()->all(), 'idRaca', 'designacao'), ['prompt' => 'Escolher Raça']);
?>

    <?php 
echo $form->field($model, 'idRebanho')->dropDownList(ArrayHelper::map(Rebanho::find()->all(), 'idRebanho', 'designacao'), ['prompt' => 'Escolher Rebanho']);
?>

    <?php 
echo $form->field($model, 'idNucleo')->dropDownList(ArrayHelper::map(Nucleo::find()->all(), 'idNucleo', 'nome'), ['prompt' => 'Escolher Núcleo']);
?>

    <div class="form-group">
        <?php 
echo Html::submitButton($model->isNewRecord ? 'Inserir' : 'Update', ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']);
?>
    </div>

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