public function actionIndex() { $aliados = Aliados::find()->count(); $reportados = Conductor::find()->count(); $reportes = Reporte::find()->count(); return $this->render('index', array('aliados' => $aliados, 'reportados' => $reportados, 'reportes' => $reportes)); }
/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = Reporte::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, 'tipo_reporte_id' => $this->tipo_reporte_id, 'conductor_id' => $this->conductor_id, 'fecha_reporte' => $this->fecha_reporte, 'aliado_id' => $this->aliado_id]); $query->andFilterWhere(['like', 'descripcion', $this->descripcion]); return $dataProvider; }
<?php use yii\helpers\Html; use yii\widgets\DetailView; use yii\helpers\Url; use app\models\Reporte; use app\models\ArchivoConductor; /* @var $this yii\web\View */ /* @var $model app\models\Conductor */ $this->title = $model->id; $this->params['breadcrumbs'][] = ['label' => 'Conductor', 'url' => ['index']]; $this->params['breadcrumbs'][] = $this->title; //Reportes Generados $losRespores = Reporte::find()->where(['conductor_id' => $model->id])->all(); $losAdjuntos = ArchivoConductor::find()->where(['conductor_id' => $model->id])->all(); ?> <div class="conductor-view"> <h1>Reportado # <?php echo Html::encode($this->title); ?> </h1> <p> <?php echo Html::a('Actualizar', ['update', 'id' => $model->id], ['class' => 'btn btn-primary']); ?> <?php echo Html::a('Nuevo', ['create'], ['class' => 'btn btn-info']); ?> <?php
/** * Finds the Reporte model based on its primary key value. * If the model is not found, a 404 HTTP exception will be thrown. * @param integer $id * @return Reporte the loaded model * @throws NotFoundHttpException if the model cannot be found */ protected function findModel($id) { if (($model = Reporte::findOne($id)) !== null) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); } }
public function getReporte() { return $this->hasMany(Reporte::className(), ['usuario_id' => 'id']); }
/** * @return \yii\db\ActiveQuery */ public function getReporte() { return $this->hasOne(Reporte::className(), ['id' => 'reporte_id']); }
/** * @return \yii\db\ActiveQuery */ public function getReportes() { return $this->hasMany(Reporte::className(), ['aliado_id' => 'id']); }