/* @var $searchModel app\models\SocialServiceManagerSearch */ /* @var $dataProvider yii\data\ActiveDataProvider */ $this->title = 'Eliminar responsables de servicio social'; $this->params['breadcrumbs'][] = $this->title; ?> <div class="social-service-manager-index"> <div class="well well-sm"> <h1><?php echo Html::encode($this->title); ?> </h1> </div> <?php echo GridView::widget(['dataProvider' => $dataProvider, 'columns' => [['class' => 'yii\\grid\\SerialColumn'], 'id', ['attribute' => 'Nombre', 'value' => function ($dataProvider) { $user = User::findOne(['id' => $dataProvider->user_id]); $person = Person::findOne(['id' => $user->person_id]); return $person->name . ' ' . $person->lastname; }], ['attribute' => 'Facultad', 'value' => function ($dataProvider) { $faculty = \app\models\Faculty::findOne(['id' => $dataProvider->faculty_id]); //$person = Person::findOne (['id' => $user->person_id]); return $faculty->name; }], ['class' => 'yii\\grid\\ActionColumn', 'template' => '{delete}', 'buttons' => ['delete' => function ($url, $model) { return Html::a('<span class="glyphicon glyphicon-trash"></span>', ['delete', 'user_id' => $model['user_id']], ['title' => Yii::t('app', 'Delete'), 'data-confirm' => Yii::t('app', '¿Estas seguro que deseas eliminar?'), 'data-method' => 'post']); }]]]]); ?> </div>
/** * Finds the Faculty model based on its primary key value. * If the model is not found, a 404 HTTP exception will be thrown. * @param integer $id * @return Faculty the loaded model * @throws NotFoundHttpException if the model cannot be found */ protected function findModel($id) { if (($model = Faculty::findOne($id)) !== null) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); } }