From 3ea379089419b3c9881fb1ff3f472ee9f3810c88 Mon Sep 17 00:00:00 2001 From: Vitaliy Date: Tue, 1 Mar 2016 12:27:26 +0200 Subject: [PATCH] 01.03.16 --- common/models/User.php | 7 ++++++- frontend/controllers/SearchController.php | 20 ++++++++++++++++++-- frontend/views/accounts/_portfolio_form.php | 4 ++++ frontend/views/layouts/admin.php | 9 ++++----- frontend/views/layouts/main.php | 12 ++++++------ frontend/views/performer/common.php | 71 ----------------------------------------------------------------------- frontend/views/search/_company_list_view.php | 79 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ frontend/views/search/_performer_list_view.php | 57 ++++++++++++++------------------------------------------- frontend/views/search/company.php | 402 ++++++++++++++---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 9 files changed, 145 insertions(+), 516 deletions(-) create mode 100644 frontend/views/search/_company_list_view.php diff --git a/common/models/User.php b/common/models/User.php index 3c67d2f..4188aa6 100755 --- a/common/models/User.php +++ b/common/models/User.php @@ -563,7 +563,12 @@ } public function getName(){ - return $this->firstname. ' '.$this->lastname; + if($this->type == 1){ + return $this->firstname. ' '.$this->lastname; + } else if($this->type == 2){ + return $this->companyInfo->name; + } + } diff --git a/frontend/controllers/SearchController.php b/frontend/controllers/SearchController.php index 43f5429..e065a45 100755 --- a/frontend/controllers/SearchController.php +++ b/frontend/controllers/SearchController.php @@ -68,12 +68,28 @@ class SearchController extends Controller public function actionCompany() { - return $this->render('company'); + $query = UserInfo::find() + ->joinWith([ 'user' ]) + ->where(['is_customer' => 1,'user.type'=>2]); + + $companies = new ActiveDataProvider([ + 'query' => $query, + 'pagination' => [ + 'pageSize' => 3, + ], + ]); + + return $this->render('company',[ + 'companies' => $companies + ]); } public function actionPerformer() { - $query = UserInfo::find()->where(['is_customer' => 1]); + $query = UserInfo::find() + ->joinWith([ 'user' ]) + ->where(['is_customer' => 1,'user.type'=>1]); + $performer = new ActiveDataProvider([ 'query' => $query, diff --git a/frontend/views/accounts/_portfolio_form.php b/frontend/views/accounts/_portfolio_form.php index 2699abb..1089b55 100644 --- a/frontend/views/accounts/_portfolio_form.php +++ b/frontend/views/accounts/_portfolio_form.php @@ -114,6 +114,10 @@ 'height' => 228, ], [ + 'width' => 152, + 'height' => 108, + ], + [ 'width' => 210, 'height' => 150, ] diff --git a/frontend/views/layouts/admin.php b/frontend/views/layouts/admin.php index 0619e13..187ac96 100755 --- a/frontend/views/layouts/admin.php +++ b/frontend/views/layouts/admin.php @@ -105,15 +105,14 @@ $this->beginContent('@app/views/layouts/main.php'); 'options' => ['class' => 'admin-menu-icons admin-menu-ico-4',], ], [ + 'label' => 'На сайт', + 'url' => \Yii::$app->user->identity->type == 1 ? ['performer/common', 'performer_id'=>\Yii::$app->user->id] : ['company/common', 'company_id'=>\Yii::$app->user->id], + ], + [ 'label' => 'Выход', 'options' => ['class'=>'logout-li'], 'url' => ['/site/logout'] ], -// [ -// 'label' => 'Общее', -// 'options' => ['class'=>'test'], -// 'url' => ['accounts/general'], -// ], ], ]); ?> diff --git a/frontend/views/layouts/main.php b/frontend/views/layouts/main.php index 230bda0..ee38f3c 100755 --- a/frontend/views/layouts/main.php +++ b/frontend/views/layouts/main.php @@ -82,7 +82,7 @@ AppAsset::register($this); if(\Yii::$app->user->isGuest) { echo Html::a('Войти в профиль', ['site/login']); } else { - echo Html::a('Редактировать профиль', ['accounts/cabinet']); + echo Html::a('Редактировать профиль', ['accounts/']); } ?> @@ -99,8 +99,8 @@ AppAsset::register($this); diff --git a/frontend/views/search/_company_list_view.php b/frontend/views/search/_company_list_view.php new file mode 100644 index 0000000..136a238 --- /dev/null +++ b/frontend/views/search/_company_list_view.php @@ -0,0 +1,79 @@ +user->getPortfolios()->limit(3)->all(), 'cover'); +?> +
+
+
+ member):?> +
PRO
+ +
NEW
+ +
user->name?>
+
+
+
+ + +
+
30 отзывов, city?>
+
+
+ Сотрудники: user->companyInfo->staff?> +
+
+
+ География работ: user->portfolios, 'city'))) ?> +
+
+
+
+ user->specializations as $specialization):?> + specialization_name ?>, + +
+
+
+
+ Последний визит: lastVisit ?> +
+
+ user->getPortfolios()->count()." работа в портфолио",[Url::toRoute(['company/portfolio','company_id'=>$model->user_id])], ['class' => "search-worker-blocks-jobs-portfolio" ])?> + +
+
+
+
+ + + + +
image)?>
+
+ +
+
+
diff --git a/frontend/views/search/_performer_list_view.php b/frontend/views/search/_performer_list_view.php index 2b62360..65a1a36 100644 --- a/frontend/views/search/_performer_list_view.php +++ b/frontend/views/search/_performer_list_view.php @@ -7,55 +7,26 @@ use yii\helpers\Url;
diff --git a/frontend/views/search/company.php b/frontend/views/search/company.php index 70f1f14..a36f000 100755 --- a/frontend/views/search/company.php +++ b/frontend/views/search/company.php @@ -1,7 +1,8 @@ title = 'My Yii Application'; ?> @@ -129,393 +130,18 @@
-
-
-
-
PRO
-
ООО «Ортекс»
-
-
-
- - -
-
30 отзывов, Киев
-
-
- Сотрудники: более 40 -
-
-
- География работ: Киев, Полтава, Харьков, Днепропетровск, Львов, Одесса -
-
- -
-
- Последний визит: 2 дня назад -
-
- 21 работа в портфолио - -
-
-
-
- - - - -
-
- -
-
-
-
-
-
-
NEW
-
ООО «Ортекс»
-
-
-
- - -
-
30 отзывов, Киев
-
-
- Сотрудники: более 40 -
-
-
- География работ: Киев, Полтава, Харьков, Днепропетровск, Львов, Одесса -
-
- -
-
- Последний визит: 2 дня назад -
-
- 21 работа в портфолио - -
-
-
-
- - - - -
-
- -
-
-
-
- -
-
-
- - - - -
-
- -
-
-
-
-
-
-
PRO
-
ООО «Ортекс»
-
-
-
- - -
-
30 отзывов, Киев
-
-
- Сотрудники: более 40 -
-
-
- География работ: Киев, Полтава, Харьков, Днепропетровск, Львов, Одесса -
-
- -
-
- Последний визит: 2 дня назад -
-
- 21 работа в портфолио - -
-
-
-
- - - - -
-
- -
-
-
- + + $companies, + 'itemView'=>'_company_list_view', + 'layout' => "{items}\n", + 'itemOptions' =>[ + 'tag' => false + ] + + ] ); + ?>
-- libgit2 0.21.4