/** * Finds the Convocatoria model based on its primary key value. * If the model is not found, a 404 HTTP exception will be thrown. * @param integer $id * @return Convocatoria the loaded model * @throws NotFoundHttpException if the model cannot be found */ protected function findModel($id) { if (($model = Convocatoria::findOne($id)) !== null) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); } }
echo Html::encode($this->title); ?> </h1> <?php // echo $this->render('_search', ['model' => $searchModel]); ?> <p> <?php echo Html::a(Yii::t('app', 'Create Comite'), ['create'], ['class' => 'btn btn-success']); ?> </p> <?php echo GridView::widget(['dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'columns' => [['class' => 'yii\\grid\\SerialColumn'], 'nombre', ['attribute' => 'fecha_inicio', 'filter' => DateControl::widget(['name' => 'fecha_inicio', 'attribute' => 'fecha_inicio', 'model' => $searchModel, 'type' => DateControl::FORMAT_DATE])], ['attribute' => 'tipo', 'value' => function ($model) { return Categoria::findOne(['id' => $model->tipo])->nombre; }, 'filter' => Select2::widget(['name' => 'tipo', 'attribute' => 'tipo', 'model' => $searchModel, 'data' => ArrayHelper::map(Categoria::find()->all(), 'id', 'nombre'), 'options' => ['placeholder' => 'Categoría'], 'pluginOptions' => ['allowClear' => true]])], ['attribute' => 'subtipo', 'value' => function ($model) { return Subcategoria::findOne(['id' => $model->subtipo])->nombre; }, 'filter' => Select2::widget(['name' => 'subtipo', 'attribute' => 'subtipo', 'model' => $searchModel, 'data' => ArrayHelper::map(Subcategoria::find()->all(), 'id', 'nombre'), 'options' => ['placeholder' => 'Subcategoría'], 'pluginOptions' => ['allowClear' => true]])], ['attribute' => 'convocatoria', 'value' => function ($model) { if (!empty(Convocatoria::findOne(['id' => $model->convocatoria]))) { return Convocatoria::findOne(['id' => $model->convocatoria])->descripcion; } else { return "N/A"; } }, 'filter' => Select2::widget(['name' => 'convocatoria', 'attribute' => 'convocatoria', 'model' => $searchModel, 'data' => ArrayHelper::map(Convocatoria::find()->all(), 'id', 'nombre'), 'options' => ['placeholder' => 'Convocatoria'], 'pluginOptions' => ['allowClear' => true]])], 'observaciones:ntext', ['attribute' => '', 'format' => 'raw', 'value' => function ($model) { return Html::a('Proyectos', ['/faer/index2', 'id' => $model->id], ['class' => 'btn btn-success btn-xs', 'style' => 'border-radius:4px;']); }], ['class' => 'yii\\grid\\ActionColumn']]]); ?> </div>