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

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

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

    <?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">