Example #1
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Raptor::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', 'species_short', $this->species_short])->andFilterWhere(['like', 'species_long', $this->species_long]);
     return $dataProvider;
 }
Example #2
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getRaptor()
 {
     return $this->hasOne(Raptor::className(), ['id' => 'raptor_id']);
 }
Example #3
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getIncident()
 {
     return $this->hasOne(Raptor::className(), ['id' => 'incident_id']);
 }
Example #4
0
 public static function raptors()
 {
     return Raptor::find()->orderBy('species_long')->all();
 }
Example #5
0
<?php

use yii\helpers\Html;
use yii\bootstrap\Tabs;
use app\models\Raptor;
/* @var $this yii\web\View */
/* @var $model app\models\Incident */
$this->title = 'Create Incident - ' . Raptor::findOne($incident->raptor_id)->species_long;
$this->params['breadcrumbs'][] = ['label' => 'Incidents', 'url' => ['index']];
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="incident-create">

    <h1><?php 
echo Html::encode($this->title);
?>
</h1>

    <?php 
echo Tabs::widget(['items' => [['label' => 'Incident', 'content' => $this->render('_form', ['incident' => $incident]), 'active' => true]]]);
?>

</div>
Example #6
0
 /**
  * Finds the Raptor model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return Raptor the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = Raptor::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }