<?php use yii\helpers\Html; use yii\grid\GridView; /* @var $this yii\web\View */ /* @var $dataProvider yii\data\ActiveDataProvider */ $this->title = Yii::t('backend', 'Members'); $this->params['breadcrumbs'][] = $this->title; ?> <div class="members-index"> <h1><?php echo Html::encode($this->title); ?> </h1> <p> <?php echo Html::a(Yii::t('backend', 'Create Members'), ['create'], ['class' => 'btn btn-success']); ?> </p> <?php echo GridView::widget(['dataProvider' => $dataProvider, 'columns' => [['class' => 'yii\\grid\\SerialColumn'], 'id', 'username', 'email:email', 'braintree_customer_id', ['attribute' => 'status', 'format' => 'html', 'value' => function ($model) { return \backend\models\Members::getStatusLabel($model->status); }], 'created_at:date', ['class' => 'yii\\grid\\ActionColumn']]]); ?> </div>
/* @var $this yii\web\View */ /* @var $model backend\models\Members */ $this->title = $model->username; $this->params['breadcrumbs'][] = ['label' => Yii::t('backend', 'Members'), 'url' => ['index']]; $this->params['breadcrumbs'][] = $this->title; $this->registerJsFile(Yii::getAlias('@web/js/dairies.js'), ['depends' => ['yii\\web\\YiiAsset', 'yii\\bootstrap\\BootstrapAsset']]); ?> <div class="members-view"> <h1><?php echo Html::encode($this->title); ?> </h1> <?php $tab_items[] = ['label' => Yii::t('backend', 'General Information'), 'content' => '<p>' . DetailView::widget(['model' => $model, 'attributes' => ['firstname', 'lastname', 'username', 'email:email', 'braintree_customer_id', 'weight', 'height', ['attribute' => 'status', 'format' => 'html', 'value' => \backend\models\Members::getStatusLabel($model->status)], 'created_at:date']]) . '</p>']; $questionItems = []; foreach ($categoriesModel as $categoryModel) { // get questions answers $questionsAnswers = new ActiveDataProvider(['query' => $categoryModel->getQuestions()->with('questionsAnswers')]); $questionItems[] = ['label' => $categoryModel->name, 'content' => '<p>' . GridView::widget(['dataProvider' => $questionsAnswers, 'summary' => '', 'showFooter' => false, 'showHeader' => false, 'columns' => ['title', ['header' => Yii::t('backend', 'Answer'), 'attribute' => 'questionsAnswers.option_id', 'value' => function ($model) { if ($model->questionsAnswers->option_id > 0) { return \backend\models\MappingQuestionsToOptions::findOne($model->questionsAnswers->option_id)->title; } else { if (!empty($model->questionsAnswers->value)) { return $model->questionsAnswers->value; } else { if (!empty($model->questionsAnswers->other)) { return $model->questionsAnswers->other; } }
/** * Finds the Members model based on its primary key value. * If the model is not found, a 404 HTTP exception will be thrown. * @param integer $id * @return Members the loaded model * @throws NotFoundHttpException if the model cannot be found */ protected function findModel($id) { if (($model = Members::findOne($id)) !== null) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); } }