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 = Conductor::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, 'ciudad_id' => $this->ciudad_id, 'aliado_id' => $this->aliado_id, 'fecha_registro' => $this->fecha_registro]); $query->andFilterWhere(['like', 'identificacion', $this->identificacion])->andFilterWhere(['like', 'nombres', $this->nombres])->andFilterWhere(['like', 'apellidos', $this->apellidos])->andFilterWhere(['like', 'direccion', $this->direccion])->andFilterWhere(['like', 'telefono', $this->telefono])->andFilterWhere(['like', 'celular', $this->celular])->andFilterWhere(['like', 'email', $this->email])->andFilterWhere(['like', 'fotografia', $this->fotografia]); return $dataProvider; }
/** * Finds the Conductor model based on its primary key value. * If the model is not found, a 404 HTTP exception will be thrown. * @param integer $id * @return Conductor the loaded model * @throws NotFoundHttpException if the model cannot be found */ protected function findModel($id) { if (($model = Conductor::findOne($id)) !== null) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); } }
public function getConductor() { return $this->hasOne(Conductor::className(), ['id' => 'reporte_id']); }
public function getConductor() { return $this->hasMany(Conductor::className(), ['usuario_id' => 'id']); }
use yii\widgets\ActiveForm; use yii\widgets\DetailView; use yii\widgets\DatePicker; /* @var $this yii\web\View */ /* @var $model app\models\Reporte */ /* @var $form yii\widgets\ActiveForm */ $losTipos = TipoReporte::find()->all(); $losArchivos = ArchivoReporte::find()->where(['reporte_id' => $model->id])->all(); $listData = ArrayHelper::map($losTipos, 'id', 'tipo_reporte'); if (isset($_GET['idReportado'])) { $idReportado = $_GET['idReportado']; } else { $idReportado = $model->conductor_id; } $losAdjuntos = ArchivoConductor::find()->where(['conductor_id' => $idReportado])->all(); $elConductor = Conductor::find()->where(['id' => $idReportado])->one(); ?> <h4>Datos de Reportado</h4> <div class="row"> <div class="col-xs-6 col-md-4"> <?php if ($losAdjuntos) { foreach ($losAdjuntos as $file) { echo Html::img($file->archivo, ['class' => 'img-responsive text-center']) . "<br>"; } //echo Html::img($model->fotografia, ['class'=>'img-responsive text-center']); } else { echo Html::img('../public/images/reportado.png', ['class' => 'img-responsive text-center']); }
/** * @return \yii\db\ActiveQuery */ public function getConductors() { return $this->hasMany(Conductor::className(), ['aliado_id' => 'id']); }
<?php use yii\helpers\Html; use yii\widgets\DetailView; use app\models\Conductor; use app\models\ArchivoReporte; use app\models\ArchivoConductor; /* @var $this yii\web\View */ /* @var $model app\models\Reporte */ $this->title = $model->id; $this->params['breadcrumbs'][] = ['label' => 'Reportes', 'url' => ['index']]; $this->params['breadcrumbs'][] = $this->title; $elConductor = Conductor::find()->where(['id' => $model->conductor_id])->one(); $losArchivos = ArchivoReporte::find()->where(['reporte_id' => $model->id])->all(); $losAdjuntos = ArchivoConductor::find()->where(['conductor_id' => $model->conductor_id])->all(); ?> <div class="reporte-view"> <h1>Reporte # <?php echo Html::encode($this->title); ?> </h1> <p> <?php echo Html::a('Actualizar', ['update', 'id' => $model->id], ['class' => 'btn btn-primary']); ?> <?php /*Html::a('Borrar', ['delete', 'id' => $model->id], [ 'class' => 'btn btn-danger', 'data' => [