From 2cee8b86bc16b072cd3b65d6c39c339d75ce950a Mon Sep 17 00:00:00 2001 From: Yarik Date: Fri, 19 Feb 2016 14:24:42 +0200 Subject: [PATCH] test --- common/models/Team.php | 5 ----- common/models/TeamSearch.php | 24 ++++++++++-------------- common/widgets/views/phone_field.php | 6 ++++-- frontend/controllers/AccountsController.php | 3 +-- frontend/views/accounts/team.php | 6 +++++- 5 files changed, 20 insertions(+), 24 deletions(-) diff --git a/common/models/Team.php b/common/models/Team.php index becbdef..2e6343c 100644 --- a/common/models/Team.php +++ b/common/models/Team.php @@ -103,11 +103,6 @@ 'max' => 255, ], [ - ['experience_from'], - 'default', - 'value' => date('Y'), - ], - [ ['link'], 'default', 'value' => '', diff --git a/common/models/TeamSearch.php b/common/models/TeamSearch.php index 6d480d1..90d61a9 100644 --- a/common/models/TeamSearch.php +++ b/common/models/TeamSearch.php @@ -41,16 +41,10 @@ [ [ 'experience_from_from', - ], - 'default', - 'value' => 0, - ], - [ - [ 'experience_from_to', ], - 'default', - 'value' => 100, + 'integer', + 'min' => 0, ], [ [ @@ -160,12 +154,14 @@ 'user_add_id' => $this->user_add_id, ]); - $query->andFilterWhere([ - 'between', - 'experience_from', - $this->experience_from_to ? ( date('Y') - $this->experience_from_to ) : ( date('Y') - 100 ), - $this->experience_from_from ? ( date('Y') - $this->experience_from_from ) : date('Y'), - ]); + if(!empty($this->experience_from_to) || !empty($this->experience_from_from)) { + $query->andFilterWhere([ + 'between', + 'experience_from', + $this->experience_from_to ? ( date('Y') - $this->experience_from_to ) : ( date('Y') - 100 ), + $this->experience_from_from ? ( date('Y') - $this->experience_from_from ) : date('Y'), + ]); + } if(!empty( $this->link ) || $this->link === '0') { $query->andFilterWhere([ diff --git a/common/widgets/views/phone_field.php b/common/widgets/views/phone_field.php index 09922d4..4f70a07 100644 --- a/common/widgets/views/phone_field.php +++ b/common/widgets/views/phone_field.php @@ -1,5 +1,7 @@
@@ -18,7 +20,7 @@ 'form-group','id'=>isset($model[$i]['parent_key']) ? $model[$i]['parent_key'] : 0 ])?>
- +
@@ -40,7 +42,7 @@ var sub_block = '
'+ '
'+ ''+ - ''+ + ''+ '
'+ ''+ '
'; diff --git a/frontend/controllers/AccountsController.php b/frontend/controllers/AccountsController.php index 7cacbb5..656b260 100755 --- a/frontend/controllers/AccountsController.php +++ b/frontend/controllers/AccountsController.php @@ -184,6 +184,7 @@ } if(!empty( \Yii::$app->request->post() )) { if(!empty( Yii::$app->request->post('Fields') )) { + Fields::saveFieldData(Yii::$app->request->post('Fields'), \Yii::$app->user->identity->id, User::className(), 'ru'); } $user_info->load(\Yii::$app->request->post()); @@ -314,7 +315,6 @@ $user = \Yii::$app->user->identity; $post = \Yii::$app->request->post(); if($gallery->load($post) && $gallery->save()) { - return $this->redirect([ 'gallery-update', 'id' => $gallery->gallery_id, @@ -340,7 +340,6 @@ $user = \Yii::$app->user->identity; $post = \Yii::$app->request->post(); if($gallery->load($post) && $gallery->save()) { - Fields::saveFieldData(Yii::$app->request->post('Fields'), \Yii::$app->user->identity->id, User::className(), 'ru'); return $this->redirect([ 'gallery-update', 'id' => $gallery->gallery_id, diff --git a/frontend/views/accounts/team.php b/frontend/views/accounts/team.php index 642f140..988d50c 100644 --- a/frontend/views/accounts/team.php +++ b/frontend/views/accounts/team.php @@ -51,7 +51,11 @@ [ 'attribute' => 'experience_from', 'value' => function($model, $key, $index, $column) { - return \Yii::$app->formatter->asDate(time(), 'yyyy') - $model->experience_from; + if(!empty($model->experience_from)) { + return \Yii::$app->formatter->asDate(time(), 'yyyy') - $model->experience_from; + } else { + return 'Год начала не задан'; + } }, 'label' => 'Опыт, лет', 'filter' => "
-- libgit2 0.21.4