_profile_info.php
5.34 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
<?php
use artbox\core\components\imagemanager\components\ImageManagerGetPath;
use artbox\core\components\imagemanager\components\ImageManagerInputWidget;
use artbox\core\models\User;
use artbox\core\models\UserData;
use yii\bootstrap\ActiveForm;
use yii\bootstrap\Html;
use yii\web\View;
/**
* @var User $user
* @var UserData $userData
* @var View $this
*/
$imageSearch = new ImageManagerGetPath(
[
'mediaPath' => Yii::getAlias('@storage'),
]
);
?>
<?php
$form = ActiveForm::begin(
[
'action' => [ 'update' ],
'method' => 'POST',
'errorCssClass' => 'has-error bad',
]
);
if (!empty( $userData->image )) {
echo Html::tag(
'div',
Html::img($imageSearch->getImagePath($userData->image)),
[
'class' => 'col-xs-6 col-xs-offset-3 profile_edit_image',
]
);
}
echo $form->field($userData, 'image')
->label(false)
->widget(
ImageManagerInputWidget::className(),
[
'showPreview' => true,
'showDeletePickedImageConfirm' => false,
]
);
echo $form->field(
$userData,
'name',
[
'inputTemplate' => '{input}' . Html::icon(
'user',
[
'prefix' => 'fa fa-',
'class' => 'form-control-feedback left',
]
),
'options' => [
'class' => 'col-sm-6 col-xs-12 has-feedback item',
],
'inputOptions' => [
'class' => 'form-control has-feedback-left',
'placeholder' => $userData->getAttributeLabel('name'),
],
'errorOptions' => [
'class' => 'help-block alert',
],
]
)
->label(false)
->textInput();
echo $form->field(
$userData,
'surname',
[
'inputTemplate' => '{input}' . Html::icon(
'user',
[
'prefix' => 'fa fa-',
'class' => 'form-control-feedback right',
]
),
'options' => [
'class' => 'col-sm-6 col-xs-12 has-feedback item',
],
'inputOptions' => [
'placeholder' => $userData->getAttributeLabel('surname'),
],
'errorOptions' => [
'class' => 'help-block alert',
],
]
)
->label(false)
->textInput();
echo $form->field(
$userData,
'email',
[
'inputTemplate' => '{input}' . Html::icon(
'envelope',
[
'prefix' => 'fa fa-',
'class' => 'form-control-feedback left',
]
),
'options' => [
'class' => 'col-sm-6 col-xs-12 has-feedback item',
],
'inputOptions' => [
'class' => 'form-control has-feedback-left',
'placeholder' => $userData->getAttributeLabel('email'),
],
'errorOptions' => [
'class' => 'help-block alert',
],
]
)
->label(false)
->textInput();
echo $form->field(
$userData,
'phone',
[
'inputTemplate' => '{input}' . Html::icon(
'phone',
[
'prefix' => 'fa fa-',
'class' => 'form-control-feedback right',
]
),
'options' => [
'class' => 'col-sm-6 col-xs-12 has-feedback item',
],
'inputOptions' => [
'placeholder' => '+38(000)000-00-00',
],
'errorOptions' => [
'class' => 'help-block alert',
],
]
)
->label(false)
->textInput();
echo Html::tag(
'div',
'',
[
'class' => 'clearfix',
]
);
echo Html::submitButton(
\Yii::t('core', 'Submit'),
[
'class' => 'btn btn-default col-xs-4 col-sm-3 col-md-2 personal_info_submit_button',
]
);
echo Html::tag(
'div',
'',
[
'class' => 'clearfix',
]
);
$form::end();
echo Html::tag('hr');
echo Html::tag(
'p',
\Yii::t(
'core',
'Registered on {date}',
[
'date' => \Yii::$app->formatter->asDate($userData->created_at),
]
),
[
'class' => 'small col-xs-6',
]
);
echo Html::tag(
'p',
\Yii::t(
'core',
'Last update on {date}',
[
'date' => \Yii::$app->formatter->asDatetime($userData->updated_at, 'php:d.m.Y H:i'),
]
),
[
'class' => 'small col-xs-6 text-right',
]
);