<?php use yii\helpers\Html; use yii\grid\GridView; use frontend\modules\user\User; /* @var $this yii\web\View */ /* @var $searchModel frontend\modules\user\models\UserSearch */ /* @var $dataProvider yii\data\ActiveDataProvider */ $this->title = User::t('user-frontend', 'Payment history'); $this->params['breadcrumbs'] = [['label' => User::t('user-frontend', 'Personal Area'), 'url' => ['default/index']], $this->title]; ?> <div class="user-index"> <?php echo GridView::widget(['dataProvider' => $dataProvider, 'columns' => [['attribute' => 'create_at'], ['attribute' => 'ticket_id', 'value' => function ($model) { return $model->ticket->title; }], 'current_cost', 'cash', 'bonus_cash', ['header' => User::t('user-frontend', 'Actions'), 'class' => 'yii\\grid\\ActionColumn', 'buttons' => ['view-pay' => function ($url, $model, $key) { return Html::a('<i class="glyphicon glyphicon-eye-open"></i>', $url, ['title' => User::t('user-frontend', 'View details'), 'class' => 'btn btn-primary btn-xs']); }], 'template' => '{view-pay}']]]); ?> </div>
<?php use frontend\modules\user\User; /* @var $this yii\web\View */ /* @var $user common\models\User */ $this->title = User::t('user-frontend', 'Update profile'); $this->params['breadcrumbs'][] = ['label' => User::t('user-frontend', 'Personal Area'), 'url' => ['index']]; $this->params['breadcrumbs'][] = $this->title; ?> <div class="user-update"> <?php echo $this->render('_form', ['profile' => $profile]); ?> </div>
echo User::t('user-frontend', 'Hello, {name}', ['name' => Yii::$app->user->identity->profile->name]); ?> </h4> <hr /> <?php // Предлагаем заполнить профиль if (empty(Yii::$app->user->identity->profile->surname) || empty(Yii::$app->user->identity->profile->gender)) { ?> <div class="bg-danger" style="padding: 10px;"> <?php echo User::t('user-frontend', 'Your profile is not full. Please fill it up, follow the link: {link}', ['link' => Html::a(User::t('user-frontend', 'Update profile'), ['update'])]); ?> </div> <hr /> <?php } ?> <h5><?php echo User::t('user-frontend', 'Balance paid employment: {count}', ['count' => $dataProvider->getTotalCount()]); ?> </h5> <?php if ($dataProvider->getTotalCount() > 0) { echo GridView::widget(['dataProvider' => $dataProvider, 'columns' => [['attribute' => 'date', 'value' => function ($model) { return Yii::$app->formatter->asTime(strtotime($model->date), 'php:d.m.Y') . ' (' . Yii::$app->formatter->asTime(strtotime($model->date), 'php:l') . ')'; }], 'timetable.start', 'timetable.end', 'timetable.group.name']]); } ?> </div>
<?php echo $form->field($profile, 'birthday')->widget(DatePicker::className(), ['id' => 'birthday', 'type' => DatePicker::TYPE_INPUT, 'language' => 'ru', 'pluginOptions' => ['autoclose' => true, 'startView' => 'decade', 'format' => 'yyyy-mm-dd']]); ?> </div> <div class="col-sm-4"> <?php echo $form->field($profile, 'gender')->dropDownList($profile->getGenderArray(), ['prompt' => User::t('user-frontend', 'Choose a gender')]); ?> </div> <div class="col-sm-4"> <?php echo $form->field($profile, 'avatar_url')->widget(Widget::className(), ['settings' => ['url' => ['fileapi-upload']], 'crop' => true, 'cropResizeWidth' => 100, 'cropResizeHeight' => 100]); ?> </div> </div> <div class="row"> <div class="col-sm-12"> <?php echo Html::submitButton(User::t('user-frontend', 'Update'), ['class' => 'btn btn-success btn-large']); ?> </div> </div> <?php ActiveForm::end(); ?> </div>
/** * Updates an existing User model. * If update is successful, the browser will be redirected to the 'view' page. * @return mixed */ public function actionUpdate() { $profile = Profile::findOne(['user_id' => Yii::$app->user->id]); $profile->setScenario('frontend-update-own'); if (Yii::$app->request->isAjax) { Yii::$app->response->format = Response::FORMAT_JSON; return ActiveForm::validate($profile); } if ($profile->load(Yii::$app->request->post()) && $profile->save()) { Yii::$app->session->setFlash('success', Module::t('user-frontend', 'Data successfully changed')); return $this->refresh(); } return $this->render('update', ['profile' => $profile]); }
<?php use kartik\sidenav\SideNav; use yii\helpers\Url; use frontend\modules\user\User; $items = [['label' => User::t('user-frontend', 'Personal Area'), 'url' => Url::toRoute(['index']), 'active' => Url::to('') == Url::to(['index'])], ['label' => User::t('user-frontend', 'Profile'), 'url' => Url::toRoute(['view']), 'active' => Url::to('') == Url::to(['view'])], ['label' => User::t('user-frontend', 'Update profile'), 'url' => Url::toRoute(['update']), 'active' => Url::to('') == Url::to(['update'])], ['label' => User::t('user-frontend', 'Payment history'), 'url' => Url::toRoute(['history']), 'active' => Url::to('') == Url::to(['history'])]]; echo SideNav::widget(['heading' => User::t('user-frontend', 'Nav'), 'items' => $items, 'type' => SideNav::TYPE_DEFAULT, 'activeCssClass' => 'side-menu-active']);
<?php use yii\helpers\Html; use yii\widgets\DetailView; use frontend\modules\user\User; /* @var $this yii\web\View */ /* @var $model \common\models\User */ /* @var $isActiveAffiliateProgram backend\modules\pay\models\Pay::isActiveAffiliateProgram(); */ $this->title = User::t('user-frontend', 'Profile'); $this->params['breadcrumbs'][] = ['label' => User::t('user-frontend', 'Personal Area'), 'url' => ['index']]; $this->params['breadcrumbs'][] = $this->title; ?> <div class="user-view"> <?php echo DetailView::widget(['model' => $model, 'attributes' => ['profile.FullAvatarUrl:image:' . Yii::t('app', 'Avatar'), 'id', 'profile.surname', 'profile.name', 'profile.middle_name', 'phone', 'email:email', ['attribute' => 'profile.gender', 'value' => $model->profile->genderArray[$model->profile->gender]], 'profile.birthday:date', 'profile.balance', 'profile.bonus_balance', 'created_at:datetime', 'updated_at:datetime', ['label' => User::t('user-frontend', 'Referral link to the home page'), 'format' => 'raw', 'value' => $isActiveAffiliateProgram ? Html::input('text', 'ref-link', Yii::$app->request->getHostInfo() . '/?ref=' . $model->id, ['class' => 'form-control input-sm', 'readonly' => 'readonly', 'onclick' => 'this.select();']) : User::t('user-frontend', 'Link available')]]]); ?> </div>