diff --git a/common/models/User.php b/common/models/User.php index 2855c3f..03e3154 100755 --- a/common/models/User.php +++ b/common/models/User.php @@ -101,6 +101,10 @@ { return [ [ + ['firstname'], + 'required', + ], + [ 'status', 'default', 'value' => self::STATUS_ACTIVE, diff --git a/common/widgets/views/phone_field.php b/common/widgets/views/phone_field.php index 2d4241e..fc8c3e6 100644 --- a/common/widgets/views/phone_field.php +++ b/common/widgets/views/phone_field.php @@ -1,5 +1,6 @@ @@ -8,24 +9,25 @@
- - - 'form-group','id'=>isset($model[$i]['parent_key']) ? $model[$i]['parent_key'] : 0 ])?> -
- - -
- - - - + for($i = 1; $i <= count($model); $i++): + $row = $i; + ?> + 'form-group', + 'id' => isset( $model[ $i ][ 'parent_key' ] ) ? $model[ $i ][ 'parent_key' ] : 0, + ]) ?> +
+ + +
+ + + +

Добавить еще

@@ -34,23 +36,22 @@ diff --git a/frontend/controllers/AccountsController.php b/frontend/controllers/AccountsController.php index a7c20d1..65df06d 100755 --- a/frontend/controllers/AccountsController.php +++ b/frontend/controllers/AccountsController.php @@ -1041,7 +1041,7 @@ $user->new_password = $post[ 'new_password' ]; } if(empty( $post[ 'old_password' ] )) { - $user->addError('old_password', 'Введите новый пароль'); + $user->addError('old_password', 'Введите старый пароль'); } else { $user->old_password = $post[ 'old_password' ]; } diff --git a/frontend/controllers/CompanyController.php b/frontend/controllers/CompanyController.php index 036692a..cd7c88f 100755 --- a/frontend/controllers/CompanyController.php +++ b/frontend/controllers/CompanyController.php @@ -16,6 +16,7 @@ use yii\data\ArrayDataProvider; use yii\data\Pagination; use yii\data\Sort; + use yii\db\ActiveQuery; use yii\helpers\ArrayHelper; use yii\web\BadRequestHttpException; use yii\web\Controller; @@ -178,7 +179,7 @@ 'pagination' => [ 'pageSize' => 9, ], - 'sort' => new Sort([ + 'sort' => new Sort([ 'defaultOrder' => [ 'portfolio_id' => SORT_DESC, ], @@ -248,15 +249,33 @@ $user = User::findOne($company_id); $portfolio = $user->getPortfolios() ->where([ 'portfolio_id' => $portfolio_id ]) - ->with('portfolioUsers') + ->with([ + 'portfolioUsers' => function($query) { + /** + * @var ActiveQuery $query + */ + $query->andWhere([ 'status' => 1 ]); + }, + ]) ->with('portfolioUsers.gallery') ->one(); if(!empty( $portfolio_user )) { $portfolio_user = PortfolioUser::find() - ->where([ 'portfolio_user_id' => $portfolio_user ]) + ->where([ + 'portfolio_user_id' => $portfolio_user, + 'status' => 1, + ]) ->with('gallery') ->with('user') ->one(); + if(empty( $portfolio_user )) { + $this->redirect([ + 'portfolio-view', + 'performer_id' => $company_id, + 'portfolio_id' => $portfolio_id, + 'type' => $type, + ]); + } } else { $portfolio->updateCounters([ 'view_count' => 1 ]); } diff --git a/frontend/controllers/PerformerController.php b/frontend/controllers/PerformerController.php index 84a76d0..f100a21 100755 --- a/frontend/controllers/PerformerController.php +++ b/frontend/controllers/PerformerController.php @@ -12,6 +12,7 @@ use yii\data\ArrayDataProvider; use yii\data\Pagination; use yii\data\Sort; + use yii\db\ActiveQuery; use yii\helpers\ArrayHelper; use yii\web\BadRequestHttpException; use yii\web\Controller; @@ -182,15 +183,33 @@ $user = User::findOne($performer_id); $portfolio = $user->getPortfolios() ->where([ 'portfolio_id' => $portfolio_id ]) - ->with('portfolioUsers') + ->with([ + 'portfolioUsers' => function($query) { + /** + * @var ActiveQuery $query + */ + $query->andWhere([ 'status' => 1 ]); + }, + ]) ->with('portfolioUsers.gallery') ->one(); if(!empty( $portfolio_user )) { $portfolio_user = PortfolioUser::find() - ->where([ 'portfolio_user_id' => $portfolio_user ]) + ->where([ + 'portfolio_user_id' => $portfolio_user, + 'status' => 1, + ]) ->with('gallery') ->with('user') ->one(); + if(empty( $portfolio_user )) { + $this->redirect([ + 'portfolio-view', + 'performer_id' => $performer_id, + 'portfolio_id' => $portfolio_id, + 'type' => $type, + ]); + } } else { $portfolio->updateCounters([ 'view_count' => 1 ]); } diff --git a/frontend/messages/ru/app.php b/frontend/messages/ru/app.php index d536bff..416d162 100644 --- a/frontend/messages/ru/app.php +++ b/frontend/messages/ru/app.php @@ -179,5 +179,4 @@ 'Feedback answer' => 'Вопрос', 'Feedback file' => 'Файл', 'Feedback date add' => 'Дата обращения', - 'Projects' => 'Проекты', ]; \ No newline at end of file diff --git a/frontend/views/accounts/_portfolio_form.php b/frontend/views/accounts/_portfolio_form.php index 4238e37..aa6f015 100644 --- a/frontend/views/accounts/_portfolio_form.php +++ b/frontend/views/accounts/_portfolio_form.php @@ -288,9 +288,9 @@ $form->end(); $.post( "/accounts/gallery-cover", {gallery_id : gallery_id}, function(data) { - if(!($('#cover_old_img').val().length)) + if(!($('#cover_old_img').val().length) && !($('#portfolio-cover').val().length)) { - $('#cover_picture_link').val(data); + $('#portfolio-cover').val(data); var newimg = document.createElement("img"); newimg.setAttribute("src", data); diff --git a/frontend/views/accounts/projects.php b/frontend/views/accounts/projects.php index 9c076cc..974791f 100755 --- a/frontend/views/accounts/projects.php +++ b/frontend/views/accounts/projects.php @@ -66,7 +66,7 @@ [ 'attribute' => 'budget', 'filter' => Html::activeInput('text', $searchModel, 'budget_approx', ['class'=>'form-control']), - 'value' => function($model, $key, $index, $column) { + 'content' => function($model, $key, $index, $column) { /** * @var Project $model */ diff --git a/frontend/views/layouts/admin.php b/frontend/views/layouts/admin.php index fa892de..7b3797e 100755 --- a/frontend/views/layouts/admin.php +++ b/frontend/views/layouts/admin.php @@ -59,7 +59,7 @@ 'active' => preg_match('/^blog.*$/', $this->context->action->id) ? true : false, ], [ - 'label' => 'Галерея Изображения', + 'label' => 'Галерея Изображений', 'url' => [ 'accounts/gallery' ], 'active' => preg_match('/^gallery(?!-video).*$/', $this->context->action->id) ? true : false, ], diff --git a/frontend/views/layouts/main.php b/frontend/views/layouts/main.php index 1e7ee46..2f57c7a 100755 --- a/frontend/views/layouts/main.php +++ b/frontend/views/layouts/main.php @@ -1,12 +1,13 @@ beginPage() ?> @@ -18,8 +19,6 @@ AppAsset::register($this); - - @@ -39,32 +38,36 @@ AppAsset::register($this);
Международная Федерация Проектантов
user->isGuest): ?> -
+ if(Yii::$app->user->isGuest): ?> +
-
- -
- 'loginLinkModal']) ?> - -
+
+
Профиль
+
+ 'loginLinkModal' ]) ?> + +
- -
- user->identity->userInfo->image)) { - echo Html::img(Yii::$app->user->identity->minImg(Yii::$app->user->identity->userInfo->image,48,48)); - } - ?> -
-
Профиль
- user->identity->email,['/accounts']) ?> - + +
+ user->identity->userInfo->image )) { + echo Html::img(Yii::$app->user->identity->minImg(Yii::$app->user->identity->userInfo->image, 48, 48)); + } + ?> +
+
Профиль
+ user->identity->email, [ '/accounts' ]) ?> +
@@ -82,18 +85,18 @@ AppAsset::register($this);
  • user->isGuest) { - echo Html::a('Войти в профиль', ['site/login']); - } else { - echo Html::a('Редактировать профиль', ['accounts/']); - } + if(\Yii::$app->user->isGuest) { + echo Html::a('Войти в профиль', [ 'site/login' ]); + } else { + echo Html::a('Редактировать профиль', [ 'accounts/' ]); + } ?>
  • @@ -102,13 +105,19 @@ AppAsset::register($this); @@ -117,14 +126,14 @@ AppAsset::register($this); @@ -133,12 +142,12 @@ AppAsset::register($this);
    - +
    - +
      -
    • +
    • Исполнители
    • Заказчики
    @@ -148,25 +157,25 @@ AppAsset::register($this); user->isGuest) { echo Menu::widget([ - 'options' => [ - 'tag' => 'div', + 'options' => [ + 'tag' => 'div', 'class' => 'main-menu-icons-wr', ], 'itemOptions' => [ 'tag' => false, ], - 'items' => [ + 'items' => [ [ - 'url' => ['/projects'], - 'template' => ''.count(\Yii::$app->user->identity->commentProjects).'', + 'url' => [ '/projects' ], + 'template' => '' . count(\Yii::$app->user->identity->commentProjects) . '', ], [ - 'url' => ['chat/list'], - 'template' => ''.\Yii::$app->user->identity->chatCount.'', + 'url' => [ 'chat/list' ], + 'template' => '' . \Yii::$app->user->identity->chatCount . '', ], [ - 'url' => ['/bookmarks'], - 'template' => "".count(\Yii::$app->user->identity->bookmarks)."", + 'url' => [ '/bookmarks' ], + 'template' => "" . count(\Yii::$app->user->identity->bookmarks) . "", ], ], ]); @@ -189,70 +198,78 @@ AppAsset::register($this); -- libgit2 0.21.4