Created
January 1, 2015 02:33
-
-
Save evercode1/2e76c6829de11952594a to your computer and use it in GitHub Desktop.
profile view page chap 8
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| use yii\helpers\Html; | |
| use yii\widgets\DetailView; | |
| use common\models\PermissionHelpers; | |
| /** | |
| * @var yii\web\View $this | |
| * @var app\models\Profile $model | |
| */ | |
| $this->title = $model->user->username . "'s Profile"; | |
| $this->params['breadcrumbs'][] = ['label' => 'Profiles', 'url' => ['index']]; | |
| $this->params['breadcrumbs'][] = $this->title; | |
| ?> | |
| <div class="profile-view"> | |
| <h1><?= Html::encode($this->title) ?></h1> | |
| <p> | |
| <?Php | |
| //this is not necessary but in here as example | |
| if (PermissionHelpers::userMustBeOwner('profile', $model->id)) { | |
| echo Html::a('Update', ['update', 'id' => $model->id], | |
| ['class' => 'btn btn-primary']); | |
| } | |
| ?> | |
| <?= Html::a('Delete', ['delete', 'id' => $model->id], [ | |
| 'class' => 'btn btn-danger', | |
| 'data' => [ | |
| 'confirm' => Yii::t('app', 'Are you sure to delete this item?'), | |
| 'method' => 'post', | |
| ], | |
| ]) ?> | |
| </p> | |
| <?= DetailView::widget([ | |
| 'model' => $model, | |
| 'attributes' => [ | |
| //'id', | |
| 'user.username', | |
| 'first_name', | |
| 'last_name', | |
| 'birthdate', | |
| 'gender.gender_name', | |
| 'created_at', | |
| 'updated_at', | |
| //'user_id', | |
| ], | |
| ]) ?> | |
| </div> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
line 9 * @var frontend\models\Profile $model