Commit 3d16390953c8e28082cf03cb00366b0310a2d807
Merge remote-tracking branch 'origin/master'
# Conflicts: # frontend/controllers/AccountsController.php
Showing
11 changed files
with
271 additions
and
158 deletions
Show diff stats
1 | +$('body').on('click', '.delete-field-item', function(){ | |
2 | + | |
3 | + $(this).parent('.form-group').remove(); | |
4 | + | |
5 | +}); | |
6 | + | |
7 | + | |
8 | +$('.add_field').click(function(){ | |
9 | + var block = $('.fields_video_result'); | |
10 | + var sub_block = '<div class="form-group">'+ | |
11 | + '<input type="text" class="form-control" value="" name="Fields[video]['+ start_i++ +'][value]">'+ | |
12 | + '<span data-id="none" title="удалить" class="glyphicon glyphicon-trash delete-field-item"></span>'+ | |
13 | + '<div>'; | |
14 | + block.append(sub_block); | |
15 | + | |
16 | +}); | |
0 | 17 | \ No newline at end of file | ... | ... |
backend/web/js/option.js
... | ... | @@ -58,55 +58,55 @@ $(function() { |
58 | 58 | } |
59 | 59 | return false; |
60 | 60 | }); |
61 | - //$.each($('.nav-tabs.f32'), function(key, value) { | |
62 | - // if($(value).find('li').length > 1) { | |
63 | - // $(value).find('li').append('<span class="glyphicon glyphicon-remove-circle remove-lang"></span>'); | |
64 | - // } | |
65 | - //}); | |
66 | - //$(document).on('click', '.dropdown-menu.f32:not(.old) li a[data-lang]', function() { | |
67 | - // var lang = $(this).data('lang'); | |
68 | - // var flag = $(this).find('span').first().clone(); | |
69 | - // var el = $(this); | |
70 | - // var id = $(this).attr('href').substr(1); | |
71 | - // var path = form[id].handler; | |
72 | - // var view = form[id].view; | |
73 | - // var model = form[id].model; | |
74 | - // $.get(path, { language_id: lang, widget_id: id, ajaxView: view, model: model }, function(data) { | |
75 | - // $('#'+id+'-tabs li').removeClass('active'); | |
76 | - // $('#'+id+'-tabs').append('<li role="lang_inputs" class="active" data-lang="'+lang+'"><a href="#'+id+'-'+lang+'" aria-controls="'+id+'-'+lang+'" role="tab" data-toggle="tab">'+$('<p>').append($(flag)).html()+'</a></li>'); | |
77 | - // $('#tab-content-'+id+' .tab-pane.active').removeClass('active'); | |
78 | - // $('#tab-content-'+id).append($(data).find('.ajax-loaded').first()); | |
79 | - // $('body').append($(data).filter('script')); | |
80 | - // $(el).parent().remove(); | |
81 | - // if(!$('#lang-'+id+' li').length) { | |
82 | - // $('#'+id+'Lang').addClass('disabled'); | |
83 | - // } | |
84 | - // if($('#'+id+'-tabs li').length > 1) { | |
85 | - // $('#'+id+'-tabs li').append('<span class="glyphicon glyphicon-remove-circle remove-lang"></span>') | |
86 | - // } | |
87 | - // }); | |
88 | - //}); | |
89 | - //$(document).on('click', '.dropdown-menu.f32.old li a[data-lang]', function(e) { | |
90 | - // e.preventDefault(); | |
91 | - // var lang = $(this).data('lang'); | |
92 | - // var flag = $(this).find('span').first().clone(); | |
93 | - // var el = $(this); | |
94 | - // var id = $(this).attr('href').substr(1); | |
95 | - // $.get(form[id], { language_id: lang, widget_id: id }, function(data) { | |
96 | - // $('#'+id+'-tabs li').removeClass('active'); | |
97 | - // $('#'+id+'-tabs').append('<li role="lang_inputs" class="active" data-lang="'+lang+'"><a href="#'+id+'-'+lang+'" aria-controls="'+id+'-'+lang+'" role="tab" data-toggle="tab">'+$('<p>').append($(flag)).html()+'</a></li>'); | |
98 | - // $('#tab-content-'+id+' .tab-pane.active').removeClass('active'); | |
99 | - // $('#tab-content-'+id).append($(data).find('.ajax-loaded').first()); | |
100 | - // $('body').append($(data).filter('script')); | |
101 | - // $(el).parent().remove(); | |
102 | - // if(!$('#lang-'+id+' li').length) { | |
103 | - // $('#'+id+'Lang').addClass('disabled'); | |
104 | - // } | |
105 | - // if($('#'+id+'-tabs li').length > 1) { | |
106 | - // $('#'+id+'-tabs li').append('<span class="glyphicon glyphicon-remove-circle remove-lang"></span>') | |
107 | - // } | |
108 | - // }); | |
109 | - //}); | |
61 | + $.each($('.nav-tabs.f32'), function(key, value) { | |
62 | + if($(value).find('li').length > 1) { | |
63 | + $(value).find('li').append('<span class="glyphicon glyphicon-remove-circle remove-lang"></span>'); | |
64 | + } | |
65 | + }); | |
66 | + $(document).on('click', '.dropdown-menu.f32:not(.old) li a[data-lang]', function() { | |
67 | + var lang = $(this).data('lang'); | |
68 | + var flag = $(this).find('span').first().clone(); | |
69 | + var el = $(this); | |
70 | + var id = $(this).attr('href').substr(1); | |
71 | + var path = form[id].handler; | |
72 | + var view = form[id].view; | |
73 | + var model = form[id].model; | |
74 | + $.get(path, { language_id: lang, widget_id: id, ajaxView: view, model: model }, function(data) { | |
75 | + $('#'+id+'-tabs li').removeClass('active'); | |
76 | + $('#'+id+'-tabs').append('<li role="lang_inputs" class="active" data-lang="'+lang+'"><a href="#'+id+'-'+lang+'" aria-controls="'+id+'-'+lang+'" role="tab" data-toggle="tab">'+$('<p>').append($(flag)).html()+'</a></li>'); | |
77 | + $('#tab-content-'+id+' .tab-pane.active').removeClass('active'); | |
78 | + $('#tab-content-'+id).append($(data).find('.ajax-loaded').first()); | |
79 | + $('body').append($(data).filter('script')); | |
80 | + $(el).parent().remove(); | |
81 | + if(!$('#lang-'+id+' li').length) { | |
82 | + $('#'+id+'Lang').addClass('disabled'); | |
83 | + } | |
84 | + if($('#'+id+'-tabs li').length > 1) { | |
85 | + $('#'+id+'-tabs li').append('<span class="glyphicon glyphicon-remove-circle remove-lang"></span>') | |
86 | + } | |
87 | + }); | |
88 | + }); | |
89 | + $(document).on('click', '.dropdown-menu.f32.old li a[data-lang]', function(e) { | |
90 | + e.preventDefault(); | |
91 | + var lang = $(this).data('lang'); | |
92 | + var flag = $(this).find('span').first().clone(); | |
93 | + var el = $(this); | |
94 | + var id = $(this).attr('href').substr(1); | |
95 | + $.get(form[id], { language_id: lang, widget_id: id }, function(data) { | |
96 | + $('#'+id+'-tabs li').removeClass('active'); | |
97 | + $('#'+id+'-tabs').append('<li role="lang_inputs" class="active" data-lang="'+lang+'"><a href="#'+id+'-'+lang+'" aria-controls="'+id+'-'+lang+'" role="tab" data-toggle="tab">'+$('<p>').append($(flag)).html()+'</a></li>'); | |
98 | + $('#tab-content-'+id+' .tab-pane.active').removeClass('active'); | |
99 | + $('#tab-content-'+id).append($(data).find('.ajax-loaded').first()); | |
100 | + $('body').append($(data).filter('script')); | |
101 | + $(el).parent().remove(); | |
102 | + if(!$('#lang-'+id+' li').length) { | |
103 | + $('#'+id+'Lang').addClass('disabled'); | |
104 | + } | |
105 | + if($('#'+id+'-tabs li').length > 1) { | |
106 | + $('#'+id+'-tabs li').append('<span class="glyphicon glyphicon-remove-circle remove-lang"></span>') | |
107 | + } | |
108 | + }); | |
109 | + }); | |
110 | 110 | $(document).on('click', '.remove-lang', function() { |
111 | 111 | var lang = $(this).parent().data('lang'); |
112 | 112 | var flag = $(this).parent().find('span.flag').first().clone(); | ... | ... |
common/models/Fields.php
... | ... | @@ -13,6 +13,9 @@ use Yii; |
13 | 13 | * @property string $value |
14 | 14 | * @property string $field_name |
15 | 15 | * @property string $field_type |
16 | + * @property string $language | |
17 | + * @property string $parent_key | |
18 | + * @property string $key | |
16 | 19 | */ |
17 | 20 | class Fields extends \yii\db\ActiveRecord |
18 | 21 | { |
... | ... | @@ -31,8 +34,8 @@ class Fields extends \yii\db\ActiveRecord |
31 | 34 | { |
32 | 35 | return [ |
33 | 36 | [['table_name', 'table_id',], 'required'], |
34 | - [['table_id','language'], 'integer'], | |
35 | - [['table_name', 'value', 'field_name','field_type'], 'string', 'max' => 255] | |
37 | + [['table_id','parent_key','key'], 'integer'], | |
38 | + [['table_name', 'value', 'field_name','field_type','language'], 'string', 'max' => 255] | |
36 | 39 | ]; |
37 | 40 | } |
38 | 41 | |
... | ... | @@ -54,4 +57,44 @@ class Fields extends \yii\db\ActiveRecord |
54 | 57 | public static function getData($id, $model, $type){ |
55 | 58 | return self::find()->where(['table_id'=>$id, 'table_name'=>$model, 'field_type'=>$type])->all(); |
56 | 59 | } |
60 | + | |
61 | + | |
62 | + /** | |
63 | + * @param $post - array with field data | |
64 | + * @param $table_id - row id in model table | |
65 | + * @param $table_name - madel table name | |
66 | + * @param $language - language id | |
67 | + */ | |
68 | + | |
69 | + public static function saveFieldData($post,$table_id,$table_name, $language){ | |
70 | + | |
71 | + self::deleteAll(['table_id'=>$table_id, 'table_name'=>$table_name, 'language' => $language]); | |
72 | + | |
73 | + if($post){ | |
74 | + | |
75 | + | |
76 | + foreach($post as $k => $field){ | |
77 | + | |
78 | + | |
79 | + | |
80 | + foreach($field as $parent_key => $row){ | |
81 | + | |
82 | + foreach($row as $key => $value){ | |
83 | + | |
84 | + $field_model = new Fields(); | |
85 | + $field_model->field_name = array_keys($value)[0]; | |
86 | + $field_model->value = $value[array_keys($value)[0]]; | |
87 | + $field_model->table_name = $table_name; | |
88 | + $field_model->table_id = $table_id; | |
89 | + $field_model->field_type = $k; | |
90 | + $field_model->language = 'ru'; | |
91 | + $field_model->parent_key = $parent_key; | |
92 | + $field_model->key = $key; | |
93 | + $field_model->save(); | |
94 | + } | |
95 | + | |
96 | + } | |
97 | + } | |
98 | + } | |
99 | + } | |
57 | 100 | } | ... | ... |
common/models/User.php
... | ... | @@ -254,9 +254,13 @@ class User extends ActiveRecord implements IdentityInterface, UserRbacInterface |
254 | 254 | } |
255 | 255 | } |
256 | 256 | |
257 | - public function afterSave ($insert, $changedAttributes) | |
258 | - { | |
259 | - parent::afterSave ($insert, $changedAttributes); | |
260 | - \Yii::$app->options->createOptions($this->id); | |
257 | +// public function afterSave ($insert, $changedAttributes) | |
258 | +// { | |
259 | +// parent::afterSave ($insert, $changedAttributes); | |
260 | +// \Yii::$app->options->createOptions($this->id); | |
261 | +// } | |
262 | + | |
263 | + public function getUserInfo(){ | |
264 | + return $this->hasOne(UserInfo::className(), ['user_id' => 'id']); | |
261 | 265 | } |
262 | 266 | } | ... | ... |
common/widgets/FieldEditor.php
1 | 1 | <?php |
2 | 2 | namespace common\widgets; |
3 | 3 | use common\models\Fields; |
4 | +use common\models\Language; | |
4 | 5 | use yii\base\Widget; |
5 | - | |
6 | +use yii\helpers\ArrayHelper; | |
6 | 7 | |
7 | 8 | class FieldEditor extends Widget |
8 | 9 | { |
9 | 10 | public $item_id; |
10 | 11 | public $model; |
11 | 12 | public $template; |
13 | + public $language; | |
12 | 14 | |
13 | 15 | public function init(){ |
14 | 16 | |
... | ... | @@ -25,14 +27,18 @@ class FieldEditor extends Widget |
25 | 27 | $widgetData= [new Fields()]; |
26 | 28 | } |
27 | 29 | |
28 | - | |
29 | - return $this->render($this->template.'_field',['model'=>$widgetData]); | |
30 | + return $this->render($this->template.'_field',['model'=>ArrayHelper::toArray($widgetData)]); | |
30 | 31 | } |
31 | 32 | |
32 | 33 | protected function findModel() |
33 | 34 | { |
34 | - if (($model = Fields::find()->where(['table_id'=>$this->item_id, 'table_name'=>$this->model, 'field_type'=>$this->template])->all()) !== null) { | |
35 | 35 | |
36 | + if (($model = Fields::find()->where([ | |
37 | + 'table_id'=>$this->item_id, | |
38 | + 'table_name'=>$this->model, | |
39 | + 'field_type'=>$this->template, | |
40 | + 'language'=>$this->language, | |
41 | + ])->all())) { | |
36 | 42 | return $model; |
37 | 43 | |
38 | 44 | } else { | ... | ... |
1 | +<?php | |
2 | +use yii\helpers\Html; | |
3 | +?> | |
4 | +<fieldset> | |
5 | + | |
6 | + <legend>Образование</legend> | |
7 | + | |
8 | + <p class="btn btn-success add_field">Добавить поле</p> | |
9 | + | |
10 | + | |
11 | + <?php for($i=1; $i <= count($model); $i++): | |
12 | + $row = $i; | |
13 | + ?> | |
14 | + | |
15 | + <?= Html::beginTag('div',['class'=>'form-group','id'=>isset($model[$i]['parent_key']) ? $model[$i]['parent_key'] : 0 ])?> | |
16 | + <input type="text" placeholder="С" class="form-control" value="<?= isset($model[$i]['value']) ? $model[$i]['value'] : '' ?>" name="Fields[education][<?=$row?>][0][year_from]" /> | |
17 | + <input type="text" placeholder="По" class="form-control" value="<?= isset($model[++$i]['value']) ? $model[$i]['value'] : '' ?>" name="Fields[education][<?=$row?>][1][year_to]" /> | |
18 | + <textarea placeholder="Место" name="Fields[education][<?=$row?>][2][place]" /><?= isset($model[++$i]['value']) ? $model[$i]['value'] : '' ?></textarea> | |
19 | + <span data-id="<?= isset($model[$i]['parent_key']) ? $model[$i]['parent_key'] : 0 ?>" title="удалить" class="glyphicon glyphicon-trash delete-field-item"></span> | |
20 | + <?= Html::endTag('div')?> | |
21 | + <?php endfor; ?> | |
22 | + | |
23 | + | |
24 | + | |
25 | +</fieldset> | |
26 | +<script> | |
27 | + $( document ).ready(function(){ | |
28 | + var start_i = <?=$i?>; | |
29 | + $('.add_field').click(function(){ | |
30 | + var block = $(this).parent('fieldset'); | |
31 | + var block_id = $(this).parent('fieldset'); | |
32 | + var sub_block = '<div class="form-group" >'+ | |
33 | + '<input type="text" placeholder="С" class="form-control" value="" name="Fields[education]['+ start_i++ +'][0][year_from]" />'+ | |
34 | + '<input type="text" placeholder="По" class="form-control" value="" name="Fields[education]['+ start_i +'][1][year_to]" />'+ | |
35 | + '<textarea placeholder="Место" name="Fields[education]['+ start_i +'][2][place]" /></textarea>'+ | |
36 | + '<span title="удалить" class="glyphicon glyphicon-trash delete-field-item"></span>'+ | |
37 | + '<div>'; | |
38 | + block.append(sub_block); | |
39 | + | |
40 | + }); | |
41 | + }); | |
42 | +</script> | |
43 | + | |
44 | + | ... | ... |
console/migrations/m160128_101543_fields.php
... | ... | @@ -15,7 +15,9 @@ class m160128_101543_fields extends Migration |
15 | 15 | 'value' => $this->string(255), |
16 | 16 | 'field_name' => $this->string(), |
17 | 17 | 'field_type' => $this->string(32)->notNull(), |
18 | - 'language' => $this->integer() | |
18 | + 'language' => $this->string(3), | |
19 | + 'key' => $this->integer(), | |
20 | + 'parent_key' => $this->integer() | |
19 | 21 | ], $tableOptions); |
20 | 22 | |
21 | 23 | } | ... | ... |
frontend/assets/AdminAsset.php
frontend/controllers/AccountsController.php
1 | 1 | <?php |
2 | 2 | namespace frontend\controllers; |
3 | 3 | |
4 | +use common\models\Fields; | |
4 | 5 | use common\models\Language; |
5 | 6 | use Yii; |
6 | 7 | use common\models\User; |
... | ... | @@ -27,7 +28,7 @@ class AccountsController extends Controller |
27 | 28 | 'class' => AccessControl::className(), |
28 | 29 | 'rules' => [ |
29 | 30 | [ |
30 | - 'actions' => ['cabinet','change-password', 'bookmarks', 'projects'], | |
31 | + 'actions' => ['cabinet','change-password', 'bookmarks'], | |
31 | 32 | 'allow' => true, |
32 | 33 | 'roles' => ['@'], |
33 | 34 | ], |
... | ... | @@ -43,18 +44,28 @@ class AccountsController extends Controller |
43 | 44 | |
44 | 45 | $user = $this->findUser(Yii::$app->user->identity->id); |
45 | 46 | |
46 | - $user_info = $this->findUserInfo(Yii::$app->user->identity->id); | |
47 | - | |
48 | 47 | $langs = Language::getActiveLanguages(); |
49 | 48 | |
50 | 49 | |
50 | + if ($user->load(Yii::$app->request->post()) && $user->save()) { | |
51 | + $user->userInfo->load(Yii::$app->request->post()); | |
52 | + $user->userInfo->save(); | |
53 | + Fields::saveFieldData( Yii::$app->request->post('Fields'), $user->id, $user::className()); | |
54 | + return $this->render('cabinet', [ | |
55 | + 'user' => $user, | |
56 | + 'user_info' => $user->userInfo, | |
57 | + 'langs' => $langs, | |
58 | + ]); | |
51 | 59 | |
52 | - return $this->render('cabinet', [ | |
53 | - 'user' => $user, | |
54 | - 'user_info' => $user_info, | |
55 | - 'langs' => $langs, | |
56 | - ]); | |
60 | + } else { | |
57 | 61 | |
62 | + return $this->render('cabinet', [ | |
63 | + 'user' => $user, | |
64 | + 'user_info' => $user->userInfo, | |
65 | + 'langs' => $langs, | |
66 | + ]); | |
67 | + | |
68 | + } | |
58 | 69 | |
59 | 70 | |
60 | 71 | } |
... | ... | @@ -65,12 +76,15 @@ class AccountsController extends Controller |
65 | 76 | } |
66 | 77 | |
67 | 78 | |
68 | - | |
69 | - | |
79 | + /** | |
80 | + * @param $id | |
81 | + * @return User | |
82 | + * @throws NotFoundHttpException | |
83 | + */ | |
70 | 84 | protected function findUser($id) |
71 | 85 | { |
72 | 86 | |
73 | - if (($model = User::findOne(["id"=>$id])) !== null) { | |
87 | + if ($model = User::findOne(["id"=>$id])) { | |
74 | 88 | return $model; |
75 | 89 | } else { |
76 | 90 | throw new NotFoundHttpException('The requested page does not exist.'); |
... | ... | @@ -79,19 +93,4 @@ class AccountsController extends Controller |
79 | 93 | |
80 | 94 | |
81 | 95 | |
82 | - protected function findUserInfo($id) | |
83 | - { | |
84 | - | |
85 | - if (($model = UserInfo::findOne(["user_id"=>$id])) !== null) { | |
86 | - return $model; | |
87 | - } else { | |
88 | - throw new NotFoundHttpException('The requested page does not exist.'); | |
89 | - } | |
90 | - } | |
91 | - | |
92 | - public function actionProjects() | |
93 | - { | |
94 | - return $this->render('projects'); | |
95 | - } | |
96 | - | |
97 | 96 | } | ... | ... |
frontend/controllers/SiteController.php
... | ... | @@ -94,70 +94,70 @@ class SiteController extends Controller |
94 | 94 | } |
95 | 95 | |
96 | 96 | // creat new model table Social and new model User |
97 | - $social = new Social(); | |
98 | - $user = new User(); | |
99 | - | |
100 | - $serviceName = Yii::$app->getRequest()->getQueryParam('service'); | |
101 | - | |
102 | - if (isset($serviceName)) { | |
103 | - /** @var $eauth \nodge\eauth\ServiceBase */ | |
104 | - $eauth = Yii::$app->get('eauth')->getIdentity($serviceName); | |
105 | - $eauth->setRedirectUrl(Yii::$app->getUser()->getReturnUrl()); | |
106 | - $eauth->setCancelUrl(Yii::$app->getUrlManager()->createAbsoluteUrl('site/login')); | |
107 | - | |
108 | - try { | |
109 | - if ($eauth->authenticate()) { | |
110 | - $identity = User::findByEAuth($eauth); | |
111 | - Yii::$app->getUser()->login($identity); | |
112 | - | |
113 | - //Save date get social network in database | |
114 | - if (! $social::find()->where(['social_user_id' => $identity[profile][id], 'social_name' => $identity[profile][service]])->exists()) { | |
115 | - $name = explode(' ',$identity[profile][name]); | |
116 | - $user->firstname = $name[0]; | |
117 | - $user->lastname = $name[1]; | |
118 | - $user->id_system_date = date("d.m.y.H:i:s"); | |
119 | - $user->save(); | |
120 | - $social->social_name = $identity[profile][service]; | |
121 | - $social->social_user_id = $identity[profile][id]; | |
122 | - $social->user_id = $user->id; | |
123 | - $social->validate(); | |
124 | - $social->errors; | |
125 | - $social->save(); | |
126 | - } | |
127 | - | |
128 | - // special redirect with closing popup window | |
129 | - $eauth->redirect(); | |
130 | - } | |
131 | - else { | |
132 | - // close popup window and redirect to cancelUrl | |
133 | - $eauth->cancel(); | |
134 | - } | |
135 | - } | |
136 | - catch (\nodge\eauth\ErrorException $e) { | |
137 | - // save error to show it later | |
138 | - Yii::$app->getSession()->setFlash('error', 'EAuthException: '.$e->getMessage()); | |
139 | - | |
140 | - // close popup window and redirect to cancelUrl | |
141 | - // $eauth->cancel(); | |
142 | - $eauth->redirect($eauth->getCancelUrl()); | |
143 | - } | |
144 | - } | |
145 | - | |
146 | - | |
147 | - | |
148 | - | |
149 | - if (!\Yii::$app->user->isGuest) { | |
150 | - return $this->goHome(); | |
151 | - } | |
152 | - | |
153 | - $model = new LoginForm(); | |
154 | - if ($model->load(Yii::$app->request->post()) && $model->login()) { | |
155 | - return $this->goBack(); | |
156 | - } else { | |
157 | - return $this->render('login', [ | |
158 | - 'model' => $model, | |
159 | - ]); | |
160 | - } | |
97 | +// $social = new Social(); | |
98 | +// $user = new User(); | |
99 | +// | |
100 | +// $serviceName = Yii::$app->getRequest()->getQueryParam('service'); | |
101 | +// | |
102 | +// if (isset($serviceName)) { | |
103 | +// /** @var $eauth \nodge\eauth\ServiceBase */ | |
104 | +// $eauth = Yii::$app->get('eauth')->getIdentity($serviceName); | |
105 | +// $eauth->setRedirectUrl(Yii::$app->getUser()->getReturnUrl()); | |
106 | +// $eauth->setCancelUrl(Yii::$app->getUrlManager()->createAbsoluteUrl('site/login')); | |
107 | +// | |
108 | +// try { | |
109 | +// if ($eauth->authenticate()) { | |
110 | +// $identity = User::findByEAuth($eauth); | |
111 | +// Yii::$app->getUser()->login($identity); | |
112 | +// | |
113 | +// //Save date get social network in database | |
114 | +// if (! $social::find()->where(['social_user_id' => $identity[profile][id], 'social_name' => $identity[profile][service]])->exists()) { | |
115 | +// $name = explode(' ',$identity[profile][name]); | |
116 | +// $user->firstname = $name[0]; | |
117 | +// $user->lastname = $name[1]; | |
118 | +// $user->id_system_date = date("d.m.y.H:i:s"); | |
119 | +// $user->save(); | |
120 | +// $social->social_name = $identity[profile][service]; | |
121 | +// $social->social_user_id = $identity[profile][id]; | |
122 | +// $social->user_id = $user->id; | |
123 | +// $social->validate(); | |
124 | +// $social->errors; | |
125 | +// $social->save(); | |
126 | +// } | |
127 | +// | |
128 | +// // special redirect with closing popup window | |
129 | +// $eauth->redirect(); | |
130 | +// } | |
131 | +// else { | |
132 | +// // close popup window and redirect to cancelUrl | |
133 | +// $eauth->cancel(); | |
134 | +// } | |
135 | +// } | |
136 | +// catch (\nodge\eauth\ErrorException $e) { | |
137 | +// // save error to show it later | |
138 | +// Yii::$app->getSession()->setFlash('error', 'EAuthException: '.$e->getMessage()); | |
139 | +// | |
140 | +// // close popup window and redirect to cancelUrl | |
141 | +// // $eauth->cancel(); | |
142 | +// $eauth->redirect($eauth->getCancelUrl()); | |
143 | +// } | |
144 | +// } | |
145 | +// | |
146 | +// | |
147 | +// | |
148 | +// | |
149 | +// if (!\Yii::$app->user->isGuest) { | |
150 | +// return $this->goHome(); | |
151 | +// } | |
152 | +// | |
153 | +// $model = new LoginForm(); | |
154 | +// if ($model->load(Yii::$app->request->post()) && $model->login()) { | |
155 | +// return $this->goBack(); | |
156 | +// } else { | |
157 | +// return $this->render('login', [ | |
158 | +// 'model' => $model, | |
159 | +// ]); | |
160 | +// } | |
161 | 161 | } |
162 | 162 | |
163 | 163 | /** | ... | ... |
frontend/views/accounts/_form.php
... | ... | @@ -17,16 +17,10 @@ use yii\widgets\ActiveForm; |
17 | 17 | |
18 | 18 | <?= $form->field($user_info, 'user_id')->textInput() ?> |
19 | 19 | |
20 | -<?= $form->field($user_info, 'view_count')->textInput() ?> | |
21 | - | |
22 | 20 | <?= $form->field($user_info, 'busy')->textInput(['maxlength' => true]) ?> |
23 | 21 | |
24 | -<?= $form->field($user_info, 'date_visit')->textInput() ?> | |
25 | - | |
26 | 22 | <?= $form->field($user_info, 'experience')->textInput() ?> |
27 | 23 | |
28 | -<?= $form->field($user_info, 'rank')->textInput(['maxlength' => true]) ?> | |
29 | - | |
30 | 24 | <?= $form->field($user_info, 'salary')->textInput(['maxlength' => true]) ?> |
31 | 25 | |
32 | 26 | <?= $form->field($user_info, 'job')->textInput(['maxlength' => true]) ?> |
... | ... | @@ -49,7 +43,12 @@ use yii\widgets\ActiveForm; |
49 | 43 | |
50 | 44 | <?= $form->field($user_info, 'about')->textarea(['rows' => 6]) ?> |
51 | 45 | |
52 | -<?= \common\widgets\FieldEditor::widget(['template'=>'', 'item_id'=> $user->id, 'model'=>'User']); ?> | |
46 | +<?= \common\widgets\FieldEditor::widget([ | |
47 | + 'template'=>'education', | |
48 | + 'item_id'=> $user->id, | |
49 | + 'model'=>'common\models\User', | |
50 | + 'language'=>'0' | |
51 | +]); ?> | |
53 | 52 | |
54 | 53 | |
55 | 54 | <div class="form-group"> | ... | ... |