mirror of
https://github.com/cgsmith/yii2-user.git
synced 2026-02-04 00:02:37 -06:00
93 lines
3.9 KiB
PHP
93 lines
3.9 KiB
PHP
<?php
|
|
|
|
/**
|
|
* @var yii\web\View $this
|
|
* @var cgsmith\user\models\Profile $model
|
|
* @var cgsmith\user\Module $module
|
|
*/
|
|
|
|
use yii\bootstrap\ActiveForm;
|
|
use yii\helpers\Html;
|
|
|
|
$this->title = Yii::t('user', 'Profile Settings');
|
|
$this->params['breadcrumbs'][] = $this->title;
|
|
?>
|
|
|
|
<div class="user-settings-profile">
|
|
<div class="row">
|
|
<div class="col-md-3">
|
|
<?= $this->render('_menu') ?>
|
|
</div>
|
|
<div class="col-md-9">
|
|
<div class="card shadow-sm">
|
|
<div class="card-header">
|
|
<h5 class="mb-0"><?= Html::encode($this->title) ?></h5>
|
|
</div>
|
|
<div class="card-body">
|
|
<?php $form = ActiveForm::begin([
|
|
'id' => 'profile-form',
|
|
'options' => ['enctype' => 'multipart/form-data'],
|
|
]); ?>
|
|
|
|
<div class="row mb-4">
|
|
<div class="col-md-4 text-center">
|
|
<?php if ($model->getAvatarUrl()): ?>
|
|
<img src="<?= Html::encode($model->getAvatarUrl(150)) ?>"
|
|
class="rounded-circle mb-3"
|
|
alt="Avatar"
|
|
width="150"
|
|
height="150">
|
|
<?php else: ?>
|
|
<div class="bg-secondary rounded-circle d-inline-flex align-items-center justify-content-center mb-3"
|
|
style="width: 150px; height: 150px;">
|
|
<span class="text-white display-4"><?= strtoupper(substr($model->user->email, 0, 1)) ?></span>
|
|
</div>
|
|
<?php endif; ?>
|
|
|
|
<?php if ($module->enableAvatarUpload): ?>
|
|
<?= $form->field($model, 'avatar_path')->fileInput(['accept' => 'image/*'])->label(Yii::t('user', 'Upload Avatar')) ?>
|
|
|
|
<?php if (!empty($model->avatar_path)): ?>
|
|
<?= Html::a(Yii::t('user', 'Delete Avatar'), ['delete-avatar'], [
|
|
'class' => 'btn btn-sm btn-outline-danger',
|
|
'data' => ['method' => 'post', 'confirm' => Yii::t('user', 'Are you sure you want to delete your avatar?')],
|
|
]) ?>
|
|
<?php endif; ?>
|
|
<?php endif; ?>
|
|
</div>
|
|
<div class="col-md-8">
|
|
<?= $form->field($model, 'name') ?>
|
|
|
|
<?= $form->field($model, 'public_email') ?>
|
|
|
|
<?= $form->field($model, 'location') ?>
|
|
|
|
<?= $form->field($model, 'website') ?>
|
|
</div>
|
|
</div>
|
|
|
|
<?= $form->field($model, 'bio')->textarea(['rows' => 4]) ?>
|
|
|
|
<?= $form->field($model, 'timezone')->dropDownList(
|
|
cgsmith\user\models\Profile::getTimezoneList(),
|
|
['prompt' => Yii::t('user', 'Select timezone...')]
|
|
) ?>
|
|
|
|
<?php if ($module->enableGravatar): ?>
|
|
<?= $form->field($model, 'use_gravatar')->checkbox() ?>
|
|
<?= $form->field($model, 'gravatar_email')
|
|
->textInput()
|
|
->hint(Yii::t('user', 'Leave empty to use your account email for Gravatar.')) ?>
|
|
<?php endif; ?>
|
|
|
|
<div class="d-grid gap-2 d-md-block">
|
|
<?= Html::submitButton(Yii::t('user', 'Save Changes'), ['class' => 'btn btn-primary']) ?>
|
|
</div>
|
|
|
|
<?php ActiveForm::end(); ?>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|