Commit 76f36646185486869423d310ae8670dd200bf291

Authored by Yarik
1 parent 5014e10b

test

common/models/User.php
... ... @@ -641,7 +641,7 @@
641 641 ])
642 642 ->andWhere([
643 643 'comment.model' => $this->className(),
644   - ]);
  644 + ])->orderBy(['date_update' => SORT_DESC]);
645 645 }
646 646  
647 647 /**
... ... @@ -828,4 +828,13 @@
828 828 ])
829 829 ->with('messages.user');
830 830 }
  831 +
  832 + public function getIsOnline()
  833 + {
  834 + if((time() - \Yii::$app->formatter->asTimestamp($this->userInfo->date_visit)) < 1800) {
  835 + return true;
  836 + } else {
  837 + return false;
  838 + }
  839 + }
831 840 }
... ...
common/models/UserInfo.php
... ... @@ -29,7 +29,7 @@
29 29 * @property integer $type
30 30 * @property string $geography
31 31 * @property integer $salary_currency
32   - * @property string $email
  32 + * @property string $email
33 33 * @property integer $hide_mail
34 34 */
35 35 class UserInfo extends \yii\db\ActiveRecord
... ... @@ -61,7 +61,6 @@
61 61 return 'user_info';
62 62 }
63 63  
64   -
65 64 /**
66 65 * @inheritdoc
67 66 */
... ... @@ -69,7 +68,7 @@
69 68 {
70 69 return [
71 70 [
72   - 'class' => 'common\behaviors\ShowImage',
  71 + 'class' => 'common\behaviors\ShowImage',
73 72 ],
74 73 ];
75 74 }
... ... @@ -203,7 +202,7 @@
203 202 'geographies',
204 203 ],
205 204 'default',
206   - 'value' => [],
  205 + 'value' => [ ],
207 206 ],
208 207 [
209 208 [
... ... @@ -218,10 +217,25 @@
218 217 'max' => 1,
219 218 ],
220 219 [
221   - ['hide_mail'],
  220 + [ 'hide_mail' ],
222 221 'default',
223 222 'value' => 0,
224   - ]
  223 + ],
  224 + [
  225 + [
  226 + 'social_vk',
  227 + 'social_t',
  228 + 'social_in',
  229 + 'social_fb',
  230 + ],
  231 + 'filter',
  232 + 'filter' => function($value) {
  233 + if(!preg_match('/^https?:\/{2}.*$/', $value)) {
  234 + $value = 'https://' . $value;
  235 + }
  236 + return $value;
  237 + },
  238 + ],
225 239 ];
226 240 }
227 241  
... ... @@ -235,6 +249,21 @@
235 249 return \Yii::$app->formatter->asRelativeTime(new \DateTime($this->date_visit));
236 250 }
237 251  
  252 + public function getLastVisitCabinet()
  253 + {
  254 + $time = strtotime($this->date_visit);
  255 + $date = date('d.m.Y', $time);
  256 + if($date == date('d.m.Y')) {
  257 + return 'Сегодня';
  258 + } elseif($date == date('d.m.Y', time() - 24 * 3600)) {
  259 + return 'Вчера';
  260 + } elseif($date == date('d.m.Y', time() - 48 * 3600)) {
  261 + return '2 дня назад';
  262 + } else {
  263 + return date('d.m.Y', $time);
  264 + }
  265 + }
  266 +
238 267 /**
239 268 * @inheritdoc
240 269 */
... ... @@ -280,8 +309,8 @@
280 309 ];
281 310 }
282 311  
283   -
284   - public function getUser(){
  312 + public function getUser()
  313 + {
285 314 return $this->hasOne(User::className(), [ 'id' => 'user_id' ]);
286 315 }
287 316  
... ... @@ -291,7 +320,8 @@
291 320 return parent::beforeSave($insert);
292 321 }
293 322  
294   - public function getName(){
  323 + public function getName()
  324 + {
295 325 return $this->user->name;
296 326 }
297 327  
... ... @@ -312,7 +342,7 @@
312 342  
313 343 public function getCurrency()
314 344 {
315   - return $this->hasOne(Currency::className(), ['currency_id' => 'salary_currency']);
  345 + return $this->hasOne(Currency::className(), [ 'currency_id' => 'salary_currency' ]);
316 346 }
317 347  
318 348 }
... ...
common/modules/comment/widgets/views/form-comment-review.php
... ... @@ -10,7 +10,7 @@
10 10  
11 11 ?>
12 12 <div class="workplace-title style">
13   - <p></p>Отзывы о пользователе: <?= $dataProvider->totalCount ?></p></div>
  13 + <p></p>Мнения о пользователе: <?= $dataProvider->totalCount ?></p></div>
14 14 <div class="new-portf-add-comm style">
15 15 <?php
16 16 $form = ActiveForm::begin();
... ...
frontend/config/main.php
... ... @@ -91,7 +91,7 @@ return [
91 91 'company/blog-view/<company_id:[\w-]+>/<link:[\w-]+>' => 'company/blog-view',
92 92 'company/vacancy-view/<company_id:[\w-]+>/<type:(?:implementer|customer)>/<link:[\w-_\s]+>' => 'company/vacancy-view',
93 93 'company/vacancy-view/<company_id:[\w-]+>/<link:[\w-_\s]+>' => 'company/vacancy-view',
94   - 'company/<action>/<company_id:[\w-]+><type:(?:implementer|customer)>' => 'company/<action>',
  94 + 'company/<action>/<company_id:[\w-]+>/<type:(?:implementer|customer)>' => 'company/<action>',
95 95 'company/<action>/<company_id:[\w-]+>' => 'company/<action>',
96 96 'chat/message/<user_id:[\w-]>'=> 'chat/message',
97 97 'tender/view/<tender_id:[\d-]+>' => 'tender/view',
... ...
frontend/controllers/AccountsController.php
... ... @@ -412,7 +412,7 @@
412 412 $company_info = $user->companyInfo;
413 413 $user = \Yii::$app->user->identity;
414 414 if(empty( $user_info )) {
415   - $user_info = new UserInfo([ 'user_id' => $user->id ]);
  415 + //$user_info = new UserInfo([ 'user_id' => $user->id ]);
416 416 }
417 417  
418 418 if(empty( $company_info )) {
... ...
frontend/controllers/CompanyController.php
... ... @@ -104,6 +104,27 @@
104 104 ]);
105 105 }
106 106  
  107 + public function actionProjects($company_id, $type = 'implementer')
  108 + {
  109 + $company = User::findOne($company_id);
  110 +
  111 + if(!$company instanceof User) {
  112 + throw new BadRequestHttpException('Пользователь не найден');
  113 + }
  114 +
  115 + $dataProvider = new ActiveDataProvider([
  116 + 'query' => $company->getProjects(),
  117 + 'pagination' => [
  118 + 'pageSize' => 10,
  119 + ],
  120 + ]);
  121 +
  122 + return $this->render('project-list', [
  123 + 'company' => $company,
  124 + 'dataProvider' => $dataProvider,
  125 + ]);
  126 + }
  127 +
107 128 public function actionPortfolio($company_id, $type = 'implementer')
108 129 {
109 130 $company = User::findOne($company_id);
... ... @@ -398,4 +419,12 @@
398 419 'videos' => $videos,
399 420 ]);
400 421 }
  422 +
  423 + public function beforeAction($action)
  424 + {
  425 + if(!empty(\Yii::$app->request->get('type'))) {
  426 + $action->controller->view->params['type'] = \Yii::$app->request->get('type');
  427 + }
  428 + return parent::beforeAction($action);
  429 + }
401 430 }
... ...
frontend/models/SignupForm.php
... ... @@ -2,6 +2,7 @@
2 2 namespace frontend\models;
3 3  
4 4 use common\models\User;
  5 +use common\models\UserInfo;
5 6 use yii\base\Model;
6 7 use Yii;
7 8  
... ... @@ -94,6 +95,7 @@ class SignupForm extends Model
94 95 $user->generateAuthKey();
95 96  
96 97 if ($user->save()) {
  98 +// $user->link('userInfo', new UserInfo(['city' => $this->city]));
97 99 return $user;
98 100 }
99 101 }
... ...
frontend/views/company/_blog_list_view.php
1 1 <?php
2 2 /**
3 3 * @var Blog $model
  4 + * @var View $parent_view
4 5 */
5 6 use common\models\Blog;
6 7 use frontend\helpers\TextHelper;
7 8 use yii\helpers\Html;
8 9 use yii\helpers\Url;
  10 + use yii\web\View;
9 11  
10 12 ?>
11 13 <div class="blog-post-wr">
... ... @@ -14,6 +16,7 @@
14 16 'company/blog-view',
15 17 'company_id' => $this->params[ 'company' ]->id,
16 18 'link' => $model->link,
  19 + 'type' => (!empty($this->params['type']))?$this->params['type']:null,
17 20 ]), [ 'class' => 'blog-new-link' ]); ?>
18 21 </div>
19 22 <div class="blog-post-icons-wr style">
... ... @@ -35,6 +38,7 @@
35 38 '/company/blog-view',
36 39 'company_id' => $this->params[ 'company' ]->id,
37 40 'link' => $model->link,
  41 + 'type' => (!empty($this->params['type']))?$this->params['type']:null,
38 42 ])); ?>
39 43 <?= TextHelper::truncateHtmlText($model->description, 1300) ?>
40 44 </div>
... ... @@ -42,5 +46,6 @@
42 46 'company/blog-view',
43 47 'company_id' => $this->params[ 'company' ]->id,
44 48 'link' => $model->link,
  49 + 'type' => (!empty($this->params['type']))?$this->params['type']:null,
45 50 ]), [ 'class' => 'blog-post-see-all style' ]); ?>
46 51 </div>
47 52 \ No newline at end of file
... ...
frontend/views/company/_company_common_blog.php
1 1 <?php
2 2 /**
3 3 * @var Blog $model
  4 + * @var View $parent_view
4 5 */
5 6 use common\models\Blog;
6 7 use yii\helpers\Html;
  8 + use yii\web\View;
7 9  
8 10 ?>
9 11 <?php
... ... @@ -11,6 +13,7 @@
11 13 'company/blog-view',
12 14 'company_id' => $model->user_id,
13 15 'link' => $model->link,
  16 + 'type' => (!empty($this->params['type']))?$this->params['type']:null,
14 17 ]);
15 18 ?>
16 19 <div class="min-post-txt">
... ... @@ -32,5 +35,6 @@
32 35 'company/blog-view',
33 36 'company_id' => $model->user_id,
34 37 'link' => $model->link,
  38 + 'type' => (!empty($this->params['type']))?$this->params['type']:null,
35 39 ]) ?>
36 40 </div>
37 41 \ No newline at end of file
... ...
frontend/views/company/_portfolio_list_view.php
1 1 <?php
2   -use yii\helpers\ArrayHelper;
3   -use yii\helpers\Html;
4   -use yii\helpers\StringHelper;
5   -use yii\helpers\Url;
  2 + /**
  3 + * @var View $parent_view
  4 + */
  5 + use yii\helpers\ArrayHelper;
  6 + use yii\helpers\Html;
  7 + use yii\helpers\StringHelper;
  8 + use yii\helpers\Url;
  9 + use yii\web\View;
6 10  
7 11 ?>
8 12 <div class="portfolio-project-blocks-wr">
... ... @@ -10,16 +14,18 @@ use yii\helpers\Url;
10 14 <div class="portfolio-project-blocks-img">
11 15 <?= Html::a(Html::img($model->cover), Url::toRoute([
12 16 'company/portfolio-view',
13   - 'company_id' => $model->user_id,
  17 + 'company_id' => $model->user_id,
14 18 'portfolio_id' => $model->portfolio_id,
  19 + 'type' => (!empty($this->params['type']))?$this->params['type']:null,
15 20 ])); ?>
16 21 </div>
17 22 <div class="portfolio-project-blocks-title-wr">
18 23 <div class="portfolio-project-blocks-title">
19 24 <?= Html::a($model->name, Url::toRoute([
20 25 'company/portfolio-view',
21   - 'company_id' => $model->user_id,
  26 + 'company_id' => $model->user_id,
22 27 'portfolio_id' => $model->portfolio_id,
  28 + 'type' => (!empty($this->params['type']))?$this->params['type']:null,
23 29 ])) ?>
24 30 </div>
25 31 </div>
... ... @@ -27,22 +33,25 @@ use yii\helpers\Url;
27 33 <div class="portfolio-project-views-wr">
28 34 <div class="portfolio-project-views ico-views-bl">
29 35 <div class="portfolio-project-views-img-wr">
30   - <div class="portfolio-project-views-img"><img src="/images/portfolio-project/ico-1.png"/></div>
  36 + <div class="portfolio-project-views-img">
  37 + <img src="/images/portfolio-project/ico-1.png"/></div>
31 38 </div>
32 39 <div class="portfolio-project-views-txt">127</div>
33 40 </div>
34 41 <div class="portfolio-project-rati ico-views-bl">
35 42 <div class="portfolio-project-views-img-wr">
36   - <div class="portfolio-project-views-img"><img src="/images/portfolio-project/ico-2.png"/></div>
  43 + <div class="portfolio-project-views-img">
  44 + <img src="/images/portfolio-project/ico-2.png"/></div>
37 45 </div>
38 46 <div class="portfolio-project-views-txt">10.0</div>
39 47 </div>
40 48 <div class="ico-views-bl">
41 49 <div class="portfolio-project-views-img-wr">
42   - <div class="portfolio-project-views-img"><img src="/images/portfolio-project/ico-3.png"/></div>
  50 + <div class="portfolio-project-views-img">
  51 + <img src="/images/portfolio-project/ico-3.png"/></div>
43 52 </div>
44 53 <div class="portfolio-project-views-txt">14</div>
45 54 </div>
46 55 </div>
47   - <div class="portfolio-project-blocks-tags"><?= StringHelper::truncate(implode(', ',ArrayHelper::getColumn($model->specializations,'specialization_name')),20)?></div>
  56 + <div class="portfolio-project-blocks-tags"><?= StringHelper::truncate(implode(', ', ArrayHelper::getColumn($model->specializations, 'specialization_name')), 20) ?></div>
48 57 </div>
49 58 \ No newline at end of file
... ...
frontend/views/company/blog-list.php
1 1 <?php
2 2  
3   -use \yii\helpers\Html;
4   -use yii\widgets\LinkPager;
5   -use yii\widgets\ListView;
  3 + use \yii\helpers\Html;
  4 + use yii\widgets\LinkPager;
  5 + use yii\widgets\ListView;
6 6  
7   -/* @var $this yii\web\View */
8   -$this->params['company'] = $company;
9   -$this->title = 'My Yii Application';
  7 + /* @var $this yii\web\View */
  8 + $this->params[ 'company' ] = $company;
  9 + $this->title = 'My Yii Application';
10 10 ?>
11 11 <div class="performer-vacancy-vacant-title-reclam-wr style">
12 12  
13   - <?=
14   - ListView::widget( [
  13 + <?= ListView::widget([
15 14 'dataProvider' => $blog,
16   - 'itemView'=>'_blog_list_view',
17   - 'summary'=>'',
18   - ] );
19   - ?>
  15 + 'itemView' => '_blog_list_view',
  16 + 'summary' => '',
  17 + 'viewParams' => [ 'parent_view' => $this ],
  18 + ]); ?>
20 19 </div>
21 20 <div class="navi-buttons-wr style">
22   - <?=
23   - LinkPager::widget([
  21 + <?= LinkPager::widget([
24 22 'pagination' => $pagination,
25   - ]);
26   - ?>
  23 + ]); ?>
27 24 </div>
... ...
frontend/views/company/common.php
1 1 <?php
2 2 /**
3   - * @var View $this
4   - * @var User $company
  3 + * @var View $this
  4 + * @var User $company
5 5 * @var ActiveDataProvider $projectProvider
6 6 * @var ActiveDataProvider $blogProvider
7 7 * @var ActiveDataProvider $commentProvider
... ... @@ -231,6 +231,7 @@
231 231 'class' => 'min-post-block',
232 232 ],
233 233 'layout' => '{items}',
  234 + 'viewParams' => [ 'parent_view' => $this ],
234 235 ]);
235 236 ?>
236 237 </div>
... ... @@ -386,6 +387,7 @@
386 387 <?= Html::a('Читать все отзывы', [
387 388 'company/review',
388 389 'company_id' => $company->id,
  390 + 'type' => (!empty($this->params['type']))?$this->params['type']:null,
389 391 ]) ?>
390 392 </div>
391 393 </div>
... ...
frontend/views/company/portfolio.php
1 1 <?php
2 2  
3   -use yii\helpers\ArrayHelper;
4   -use \yii\helpers\Html;
5   -use yii\helpers\Url;
6   -use yii\widgets\ListView;
7   -
8   -
9   -/* @var $this yii\web\View
10   - * @var $portfolio yii\data\ArrayDataProvider
11   - */
12   -$this->params['company'] = $company;
13   -$this->title = 'My Yii Application';
  3 + use yii\helpers\ArrayHelper;
  4 + use \yii\helpers\Html;
  5 + use yii\helpers\Url;
  6 + use yii\widgets\ListView;
  7 +
  8 + /* @var $this yii\web\View
  9 + * @var $portfolio yii\data\ArrayDataProvider
  10 + */
  11 + $this->params[ 'company' ] = $company;
  12 + $this->title = 'My Yii Application';
14 13 ?>
15 14 <div class="performer-vacancy-vacant-title-reclam-wr style">
16 15  
17 16 <div class="portfolio-project-wr style">
18 17 <div class="workplace-title style"><p>Проектов: <?= $portfolio->totalCount ?></p></div>
19 18 <div class="portfolio-project-tags style">
20   - <?= Html::a("Все ({$count})", ['performer/portfolio', 'performer_id'=> $company->id],
21   - ['class'=> !isset($filter_id) || empty($filter_id) ? "active-tag" : ""]);?>
  19 + <?= Html::a("Все ({$count})", [
  20 + 'performer/portfolio',
  21 + 'performer_id' => $company->id,
  22 + 'type' => ( !empty( $this->params[ 'type' ] ) ) ? $this->params[ 'type' ] : NULL,
  23 + ], [ 'class' => !isset( $filter_id ) || empty( $filter_id ) ? "active-tag" : "" ]); ?>
22 24 <a href="#" class="active-tag"></a>
23 25 <?php foreach($filters as $filter): ?>
24   - <?= Html::a("{$filter->specialization->specialization_name} ({$filter->count})",
25   - Url::toRoute(['company/portfolio-filter', 'performer_id'=> $company->id, 'filter' => $filter->specialization->specialization_id]),
26   - ['class'=> isset($filter_id) && $filter->specialization->specialization_id == $filter_id ? "active-tag" : ""]);?>
  26 + <?= Html::a("{$filter->specialization->specialization_name} ({$filter->count})", Url::toRoute([
  27 + 'company/portfolio-filter',
  28 + 'performer_id' => $company->id,
  29 + 'filter' => $filter->specialization->specialization_id,
  30 + 'type' => ( !empty( $this->params[ 'type' ] ) ) ? $this->params[ 'type' ] : NULL,
  31 + ]), [ 'class' => isset( $filter_id ) && $filter->specialization->specialization_id == $filter_id ? "active-tag" : "" ]); ?>
27 32 <?php endforeach; ?>
28 33  
29 34 </div>
... ... @@ -31,13 +36,12 @@ $this-&gt;title = &#39;My Yii Application&#39;;
31 36  
32 37 <div class="style">
33 38 <div class="portfolio-project-blocks-wrapper">
34   - <?=
35   - ListView::widget( [
  39 + <?= ListView::widget([
36 40 'dataProvider' => $portfolio,
37   - 'itemView'=>'_portfolio_list_view',
38   - 'layout' => "{items}\n<div class='navi-buttons-wr style'>{pager}</div>"
39   - ] );
40   - ?>
  41 + 'itemView' => '_portfolio_list_view',
  42 + 'layout' => "{items}\n<div class='navi-buttons-wr style'>{pager}</div>",
  43 + 'viewParams' => [ 'parent_view' => $this ],
  44 + ]); ?>
41 45  
42 46 </div>
43 47 </div>
... ...
frontend/views/company/project-list.php 0 → 100644
  1 +<?php
  2 +
  3 + use common\models\User;
  4 + use yii\data\ActiveDataProvider;
  5 + use yii\helpers\ArrayHelper;
  6 + use \yii\helpers\Html;
  7 + use yii\widgets\ListView;
  8 +
  9 + /* @var yii\web\View $this
  10 + * @var User $company
  11 + * @var ActiveDataProvider $dataProvider
  12 + */
  13 + $this->params[ 'company' ] = $company;
  14 +
  15 + $this->title = 'My Yii Application';
  16 +?>
  17 +<div class="proektant-profile-content" style="width:100%">
  18 + <div class="search-worker-title style">Сейчас <?= $dataProvider->totalCount ?> предложений</div>
  19 + <div class="search-profile-blocks-wr style">
  20 + <?= ListView::widget([
  21 + 'dataProvider' => $dataProvider,
  22 + 'itemView' => '@frontend/views/search/_projects_list_view',
  23 + 'layout' => "{items}\n<div class='navi-buttons-wr style navi-buttons-yet-wr'>{pager}</div>",
  24 + ]); ?>
  25 + </div>
  26 +</div>
... ...
frontend/views/layouts/company.php
... ... @@ -6,6 +6,7 @@
6 6  
7 7 use common\models\User;
8 8 use yii\helpers\Html;
  9 + use yii\helpers\Url;
9 10 use yii\web\View;
10 11 use yii\widgets\Menu;
11 12  
... ... @@ -15,44 +16,48 @@
15 16 <div class="section-box-14" style="background: url(<?= $this->params[ 'company' ]->userInfo->poster; ?>) 50% no-repeat ;">
16 17 <div class="box-wr">
17 18 <div class="box-all">
18   - <div class="performance-vacancy-call-back">
19   - <div class="performance-vacancy-call-back-title">Оставьте заявку<br/>и мы вам перезвоним
20   - </div>
21   - <form class="callback" action="">
  19 + <?php
  20 + if($this->params[ 'company' ]->id != \Yii::$app->user->getId()) {
  21 + ?>
  22 + <div class="performance-vacancy-call-back">
  23 + <div class="performance-vacancy-call-back-title">Оставьте заявку<br/>и мы вам перезвоним
  24 + </div>
  25 + <form class="callback" action="">
22 26  
23   - <div class="input-blocks-wrapper">
24   - <label for="callbac_name">Имя</label>
25   - <input id="callbac_name" type="text"/>
26   - </div>
  27 + <div class="input-blocks-wrapper">
  28 + <label for="callbac_name">Имя</label>
  29 + <input id="callbac_name" type="text"/>
  30 + </div>
27 31  
28   - <div class="input-blocks-wrapper">
29   - <label for="callbac_phone">Телефон</label>
30   - <input id="callbac_phone" type="text"/>
31   - </div>
  32 + <div class="input-blocks-wrapper">
  33 + <label for="callbac_phone">Телефон</label>
  34 + <input id="callbac_phone" type="text"/>
  35 + </div>
32 36  
33   - <input id="callbac_submit" type="submit" value="Перезвонить мне"/>
34   - </form>
35   - <div class="performance-vacancy-call-back-conf">Гарантируем конфидециальность</div>
36   - </div>
37   - <?php
38   - if(!empty( \Yii::$app->user->identity )) {
39   - ?>
40   - <div class="performance-vacancy-add-favorite">
41   - <?php
42   - if($this->params[ 'company' ]->isBookmarked) {
43   - echo Html::a('', [ '#' ], [
44   - 'class' => 'artbox_bookmark_remove_performer',
45   - 'data-id' => $this->params[ 'company' ]->id,
46   - ]);
47   - } else {
48   - echo Html::a('', [ '#' ], [
49   - 'class' => 'artbox_bookmark_add_performer',
50   - 'data-id' => $this->params[ 'company' ]->id,
51   - ]);
52   - }
53   - ?>
  37 + <input id="callbac_submit" type="submit" value="Перезвонить мне"/>
  38 + </form>
  39 + <div class="performance-vacancy-call-back-conf">Гарантируем конфидециальность</div>
54 40 </div>
55 41 <?php
  42 + if(!empty( \Yii::$app->user->identity )) {
  43 + ?>
  44 + <div class="performance-vacancy-add-favorite">
  45 + <?php
  46 + if($this->params[ 'company' ]->isBookmarked) {
  47 + echo Html::a('', [ '#' ], [
  48 + 'class' => 'artbox_bookmark_remove_performer',
  49 + 'data-id' => $this->params[ 'company' ]->id,
  50 + ]);
  51 + } else {
  52 + echo Html::a('', [ '#' ], [
  53 + 'class' => 'artbox_bookmark_add_performer',
  54 + 'data-id' => $this->params[ 'company' ]->id,
  55 + ]);
  56 + }
  57 + ?>
  58 + </div>
  59 + <?php
  60 + }
56 61 }
57 62 ?>
58 63 </div>
... ... @@ -73,20 +78,33 @@
73 78 'url' => [
74 79 'company/common',
75 80 'company_id' => $this->params[ 'company' ]->id,
  81 + 'type' => ( !empty( $this->params[ 'type' ] ) ) ? $this->params[ 'type' ] : NULL,
76 82 ],
77 83 ],
78 84 [
79   - 'label' => 'Выполненные работы',
80   - 'url' => [
  85 + 'label' => 'Выполненные работы',
  86 + 'url' => [
81 87 'company/portfolio',
82 88 'company_id' => $this->params[ 'company' ]->id,
  89 + 'type' => ( !empty( $this->params[ 'type' ] ) ) ? $this->params[ 'type' ] : NULL,
  90 + ],
  91 + 'visible' => ( empty( $this->params[ 'type' ] ) || $this->params[ 'type' ] == 'implementer' ) ? true : false,
  92 + ],
  93 + [
  94 + 'label' => 'Заказанные работы',
  95 + 'url' => [
  96 + 'company/projects',
  97 + 'company_id' => $this->params[ 'company' ]->id,
  98 + 'type' => ( !empty( $this->params[ 'type' ] ) ) ? $this->params[ 'type' ] : NULL,
83 99 ],
  100 + 'visible' => ( !empty( $this->params[ 'type' ] ) && $this->params[ 'type' ] == 'customer' ) ? true : false,
84 101 ],
85 102 [
86 103 'label' => 'Команда',
87 104 'url' => [
88 105 'company/team',
89 106 'company_id' => $this->params[ 'company' ]->id,
  107 + 'type' => ( !empty( $this->params[ 'type' ] ) ) ? $this->params[ 'type' ] : NULL,
90 108 ],
91 109 ],
92 110 [
... ... @@ -94,6 +112,7 @@
94 112 'url' => [
95 113 'company/vacancy-list',
96 114 'company_id' => $this->params[ 'company' ]->id,
  115 + 'type' => ( !empty( $this->params[ 'type' ] ) ) ? $this->params[ 'type' ] : NULL,
97 116 ],
98 117 ],
99 118 [
... ... @@ -101,13 +120,15 @@
101 120 'url' => [
102 121 'company/blog-list',
103 122 'company_id' => $this->params[ 'company' ]->id,
  123 + 'type' => ( !empty( $this->params[ 'type' ] ) ) ? $this->params[ 'type' ] : NULL,
104 124 ],
105 125 ],
106 126 [
107   - 'label' => 'Отзывы',
  127 + 'label' => 'Мнения',
108 128 'url' => [
109 129 'company/review',
110 130 'company_id' => $this->params[ 'company' ]->id,
  131 + 'type' => ( !empty( $this->params[ 'type' ] ) ) ? $this->params[ 'type' ] : NULL,
111 132 ],
112 133 ],
113 134 [
... ... @@ -115,6 +136,7 @@
115 136 'url' => [
116 137 'company/gallery',
117 138 'company_id' => $this->params[ 'company' ]->id,
  139 + 'type' => ( !empty( $this->params[ 'type' ] ) ) ? $this->params[ 'type' ] : NULL,
118 140 ],
119 141 ],
120 142 ],
... ... @@ -133,12 +155,38 @@
133 155 <div class="performance-vacancy-sidebar-company-job style">
134 156 <ul>
135 157 <li class="activejob">
136   - <a href="#">Испонитель</a>
  158 + <?php
  159 + if(!empty( $this->params[ 'type' ] ) && $this->params[ 'type' ] == 'implementer') {
  160 + echo Html::a('Исполнитель', Url::current([ 'type' => 'implementer' ]));
  161 + } elseif(!empty( $this->params[ 'type' ] ) && $this->params[ 'type' ] == 'customer') {
  162 + echo Html::a('Заказчик', Url::current([ 'type' => NULL ]));
  163 + } else {
  164 + echo Html::a('Исполнитель', Url::current([ 'type' => NULL ]));
  165 + }
  166 + ?>
137 167 <div class="sidebar-droped-wr style">
138 168 <ul>
139   - <li><a href="#">Заказчик</a></li>
  169 + <li>
  170 + <?php
  171 + if(!empty( $this->params[ 'type' ] ) && $this->params[ 'type' ] == 'implementer') {
  172 + echo Html::a('Заказчик', Url::current([ 'type' => 'customer' ]));
  173 + } elseif(!empty( $this->params[ 'type' ] ) && $this->params[ 'type' ] == 'customer') {
  174 + echo Html::a('Исполнитель', Url::current([ 'type' => NULL ]));
  175 + } else {
  176 + echo Html::a('Заказчик', Url::current([ 'type' => 'customer' ]));
  177 + }
  178 + ?>
  179 + </li>
140 180 <li style="display: none">
141   - <a href="#">Испонитель</a></li>
  181 + <?php
  182 + if(!empty( $this->params[ 'type' ] ) && $this->params[ 'type' ] == 'implementer') {
  183 + echo Html::a('Исполнитель', Url::current([ 'type' => 'implementer' ]));
  184 + } elseif(!empty( $this->params[ 'type' ] ) && $this->params[ 'type' ] == 'customer') {
  185 + echo Html::a('Заказчик', Url::current([ 'type' => NULL ]));
  186 + } else {
  187 + echo Html::a('Исполнитель', Url::current([ 'type' => NULL ]));
  188 + }
  189 + ?>
142 190 </ul>
143 191 </div>
144 192 </li>
... ... @@ -152,27 +200,53 @@
152 200 <input type="hidden" class="votes" value="1"/>
153 201 </div>
154 202 </div>
155   - <div class="performance-vacancy-sidebar-comm style"><?= count($this->params[ 'company' ]->comments) ?> отзывов</div>
156   - <?= Html::a('написать отзыв', ['company/review', 'company_id' => $this->params['company']->id], ['class' => 'performance-vacancy-sidebar-write style']) ?>
  203 + <div class="performance-vacancy-sidebar-comm style"><?= count($this->params[ 'company' ]->comments) ?> мнений</div>
  204 + <?php
  205 + if($this->params[ 'company' ]->id != \Yii::$app->user->getId()) {
  206 + echo Html::a('написать мнение', [
  207 + 'company/review',
  208 + 'company_id' => $this->params[ 'company' ]->id,
  209 + 'type' => ( !empty( $this->params[ 'type' ] ) ) ? $this->params[ 'type' ] : NULL,
  210 + ], [ 'class' => 'performance-vacancy-sidebar-write style' ]);
  211 + }
  212 + ?>
157 213 </div>
158 214 <div class="performer-vacancy-sidebar-img style"><?= Html::img($this->params[ 'company' ]->userInfo->image); ?></div>
159 215 <div class="performer-vacancy-sidebar-all style">
160   - <?= $this->render('/patrial/social_list',[
161   - 'params' => $this->params
162   - ])?>
  216 + <?= $this->render('/patrial/social_list', [
  217 + 'params' => $this->params,
  218 + ]) ?>
163 219 <div class="performer-vacancy-sidebar-views style">
164 220 <ul class="style">
165   - <li><img src="/images/sidebar-ico/ico-1.png" alt=""/><div class="sidebarvievstxt"><?= $this->params['company']->userInfo->view_count;?> просмотра</div></li>
166   - <li><img src="/images/sidebar-ico/ico-2.png" alt=""/><div class="sidebarvievstxt"><span class="sidebar-views-txt">На сайте: </span><?= $this->params['company']->liveTime?></div></li>
167   - <li><img src="/images/sidebar-ico/ico-3.png" alt=""/><div class="sidebarvievstxt"><span class="sidebar-views-txt">Последний визит: <br /></span><?= $this->params['company']->userInfo->lastVisit?></div></li>
168   - <li><img src="/images/sidebar-ico/ico-5.png" alt=""/><div class="sidebarvievstxt"><span class="sidebar-views-txt">Сотрудники:<br /></span><?= $this->params['company']->companyInfo->staff?></div></li>
169   - <?= $this->render('/patrial/show_phone_list',[
170   - 'phones' => $this->params['company']->phones
171   - ])?>
172   - <?= $this->render('/patrial/show_site_list',[
173   - 'sites' => $this->params['company']->site
174   - ])?>
175   - <li><img src="/images/sidebar-ico/ico-8.png" alt=""/><div class="sidebarvievstxt"><span class="sidebar-views-txt">Адрес:<br /></span><?= $this->params['company']->address?></div></li>
  221 + <li><img src="/images/sidebar-ico/ico-1.png" alt=""/>
  222 + <div class="sidebarvievstxt"><?= $this->params[ 'company' ]->userInfo->view_count; ?> просмотра</div>
  223 + </li>
  224 + <li><img src="/images/sidebar-ico/ico-2.png" alt=""/>
  225 + <div class="sidebarvievstxt">
  226 + <span class="sidebar-views-txt">На сайте: </span><?= $this->params[ 'company' ]->liveTime ?>
  227 + </div>
  228 + </li>
  229 + <li><img src="/images/sidebar-ico/ico-3.png" alt=""/>
  230 + <div class="sidebarvievstxt">
  231 + <span class="sidebar-views-txt">Последний визит: <br/></span><?= $this->params[ 'company' ]->userInfo->lastVisit ?>
  232 + </div>
  233 + </li>
  234 + <li><img src="/images/sidebar-ico/ico-5.png" alt=""/>
  235 + <div class="sidebarvievstxt">
  236 + <span class="sidebar-views-txt">Сотрудники:<br/></span><?= $this->params[ 'company' ]->companyInfo->staff ?>
  237 + </div>
  238 + </li>
  239 + <?= $this->render('/patrial/show_phone_list', [
  240 + 'phones' => $this->params[ 'company' ]->phones,
  241 + ]) ?>
  242 + <?= $this->render('/patrial/show_site_list', [
  243 + 'sites' => $this->params[ 'company' ]->site,
  244 + ]) ?>
  245 + <li><img src="/images/sidebar-ico/ico-8.png" alt=""/>
  246 + <div class="sidebarvievstxt">
  247 + <span class="sidebar-views-txt">Адрес:<br/></span><?= $this->params[ 'company' ]->address ?>
  248 + </div>
  249 + </li>
176 250 </ul>
177 251 </div>
178 252 </div>
... ...
frontend/views/layouts/gallery-company.php
1 1 <?php
2 2  
3   -use yii\helpers\Html;
4   -use yii\widgets\Breadcrumbs;
5   -use yii\widgets\Menu;
  3 + use yii\helpers\Html;
  4 + use yii\helpers\Url;
  5 + use yii\widgets\Breadcrumbs;
  6 + use yii\widgets\Menu;
6 7  
7   -\frontend\assets\AdminAsset::register($this);
8   -/* @var $content string */
9   -$this->beginContent('@app/views/layouts/main.php');
  8 + \frontend\assets\AdminAsset::register($this);
  9 + /* @var $content string */
  10 + $this->beginContent('@app/views/layouts/main.php');
10 11 ?>
11 12 <div class="section-box content">
12   - <div class="section-box-14" style="background: url('<?= $this->params['company']->userInfo->poster;?>') 50% no-repeat">
  13 + <div class="section-box-14" style="background: url('<?= $this->params[ 'company' ]->userInfo->poster; ?>') 50% no-repeat">
13 14 <div class="box-wr">
14 15 <div class="box-all">
15   - <div class="performance-vacancy-call-back">
16   - <div class="performance-vacancy-call-back-title">Оставьте заявку<br />и мы вам перезвоним</div>
17   - <form class="callback" action="">
18   - <label for="callbac_name">Имя</label>
19   - <input id="callbac_name" type="text"/>
20   - <label for="callbac_phone">Телефон</label>
21   - <input id="callbac_phone" type="text"/>
22   - <input id="callbac_submit" type="submit" value="Перезвонить мне"/>
23   - </form>
24   - <div class="performance-vacancy-call-back-conf">Гарантируем конфидециальность</div>
25   - </div>
26   - <div class="performance-vacancy-add-favorite"><a href="#"></a></div>
  16 + <?php
  17 + if($this->params[ 'company' ]->id != \Yii::$app->user->getId()) {
  18 + ?>
  19 + <div class="performance-vacancy-call-back">
  20 + <div class="performance-vacancy-call-back-title">Оставьте заявку<br/>и мы вам перезвоним
  21 + </div>
  22 + <form class="callback" action="">
  23 +
  24 + <div class="input-blocks-wrapper">
  25 + <label for="callbac_name">Имя</label>
  26 + <input id="callbac_name" type="text"/>
  27 + </div>
  28 +
  29 + <div class="input-blocks-wrapper">
  30 + <label for="callbac_phone">Телефон</label>
  31 + <input id="callbac_phone" type="text"/>
  32 + </div>
  33 +
  34 + <input id="callbac_submit" type="submit" value="Перезвонить мне"/>
  35 + </form>
  36 + <div class="performance-vacancy-call-back-conf">Гарантируем конфидециальность</div>
  37 + </div>
  38 + <?php
  39 + if(!empty( \Yii::$app->user->identity )) {
  40 + ?>
  41 + <div class="performance-vacancy-add-favorite">
  42 + <?php
  43 + if($this->params[ 'company' ]->isBookmarked) {
  44 + echo Html::a('', [ '#' ], [
  45 + 'class' => 'artbox_bookmark_remove_performer',
  46 + 'data-id' => $this->params[ 'company' ]->id,
  47 + ]);
  48 + } else {
  49 + echo Html::a('', [ '#' ], [
  50 + 'class' => 'artbox_bookmark_add_performer',
  51 + 'data-id' => $this->params[ 'company' ]->id,
  52 + ]);
  53 + }
  54 + ?>
  55 + </div>
  56 + <?php
  57 + }
  58 + }
  59 + ?>
27 60 </div>
28 61 </div>
29 62 </div>
... ... @@ -31,42 +64,80 @@ $this-&gt;beginContent(&#39;@app/views/layouts/main.php&#39;);
31 64 <div class="box-wr">
32 65 <div class="box-all">
33 66 <?php
34   - echo Menu::widget([
35   - 'options' => [
36   - 'class' => 'menu-content',
37   - ],
38   - 'activeCssClass' => 'active-menu-content',
39   - 'items' => [
40   - [
41   - 'label' => 'Общее',
42   - 'url' => ['company/common', 'company_id'=>$this->params['company']->id],
43   - ],
44   - [
45   - 'label' => 'Выполненные работы',
46   - 'url' => ['company/portfolio', 'company_id'=>$this->params['company']->id],
47   - ],
48   - [
49   - 'label' => 'Команда',
50   - 'url' => ['company/team', 'company_id'=>$this->params['company']->id],
51   - ],
52   - [
53   - 'label' => 'Вакансии',
54   - 'url' => ['company/vacancy-list', 'company_id'=>$this->params['company']->id],
55   - ],
56   - [
57   - 'label' => 'Блог',
58   - 'url' => ['company/blog-list', 'company_id'=>$this->params['company']->id],
59   - ],
60   - [
61   - 'label' => 'Отзывы',
62   - 'url' => ['company/review', 'company_id'=>$this->params['company']->id],
  67 + echo Menu::widget([
  68 + 'options' => [
  69 + 'class' => 'menu-content',
63 70 ],
64   - [
65   - 'label' => 'Галерея',
66   - 'url' => ['company/gallery', 'company_id'=>$this->params['company']->id],
  71 + 'activeCssClass' => 'active-menu-content',
  72 + 'items' => [
  73 + [
  74 + 'label' => 'Общее',
  75 + 'url' => [
  76 + 'company/common',
  77 + 'company_id' => $this->params[ 'company' ]->id,
  78 + 'type' => ( !empty( $this->params[ 'type' ] ) ) ? $this->params[ 'type' ] : NULL,
  79 + ],
  80 + ],
  81 + [
  82 + 'label' => 'Выполненные работы',
  83 + 'url' => [
  84 + 'company/portfolio',
  85 + 'company_id' => $this->params[ 'company' ]->id,
  86 + 'type' => ( !empty( $this->params[ 'type' ] ) ) ? $this->params[ 'type' ] : NULL,
  87 + ],
  88 + 'visible' => ( empty( $this->params[ 'type' ] ) || $this->params['type'] == 'implementer' ) ? true : false,
  89 + ],
  90 + [
  91 + 'label' => 'Заказанные работы',
  92 + 'url' => [
  93 + 'company/projects',
  94 + 'company_id' => $this->params[ 'company' ]->id,
  95 + 'type' => ( !empty( $this->params[ 'type' ] ) ) ? $this->params[ 'type' ] : NULL,
  96 + ],
  97 + 'visible' => ( !empty( $this->params[ 'type' ] ) && $this->params['type'] == 'customer' ) ? true : false,
  98 + ],
  99 + [
  100 + 'label' => 'Команда',
  101 + 'url' => [
  102 + 'company/team',
  103 + 'company_id' => $this->params[ 'company' ]->id,
  104 + 'type' => ( !empty( $this->params[ 'type' ] ) ) ? $this->params[ 'type' ] : NULL,
  105 + ],
  106 + ],
  107 + [
  108 + 'label' => 'Вакансии',
  109 + 'url' => [
  110 + 'company/vacancy-list',
  111 + 'company_id' => $this->params[ 'company' ]->id,
  112 + 'type' => ( !empty( $this->params[ 'type' ] ) ) ? $this->params[ 'type' ] : NULL,
  113 + ],
  114 + ],
  115 + [
  116 + 'label' => 'Блог',
  117 + 'url' => [
  118 + 'company/blog-list',
  119 + 'company_id' => $this->params[ 'company' ]->id,
  120 + 'type' => ( !empty( $this->params[ 'type' ] ) ) ? $this->params[ 'type' ] : NULL,
  121 + ],
  122 + ],
  123 + [
  124 + 'label' => 'Мнения',
  125 + 'url' => [
  126 + 'company/review',
  127 + 'company_id' => $this->params[ 'company' ]->id,
  128 + 'type' => ( !empty( $this->params[ 'type' ] ) ) ? $this->params[ 'type' ] : NULL,
  129 + ],
  130 + ],
  131 + [
  132 + 'label' => 'Галерея',
  133 + 'url' => [
  134 + 'company/gallery',
  135 + 'company_id' => $this->params[ 'company' ]->id,
  136 + 'type' => ( !empty( $this->params[ 'type' ] ) ) ? $this->params[ 'type' ] : NULL,
  137 + ],
  138 + ],
67 139 ],
68   - ],
69   - ]);
  140 + ]);
70 141 ?>
71 142 </div>
72 143 </div>
... ... @@ -77,15 +148,42 @@ $this-&gt;beginContent(&#39;@app/views/layouts/main.php&#39;);
77 148 <div class="performer-vacancy-sidebar-left-wr gallery-page-sidebar">
78 149 <div class="performer-vacancy-sidebar-left">
79 150 <div class="performance-vacancy-sidebar-company-wr">
80   - <div class="performance-vacancy-sidebar-company-title style">Познякижилстрой</div>
  151 + <div class="performance-vacancy-sidebar-company-title style"><?= $this->params[ 'company' ]->name ?></div>
81 152 <div class="performance-vacancy-sidebar-company-job style">
82 153 <ul>
83 154 <li class="activejob">
84   - <a href="#">Испонитель</a>
  155 + <?php
  156 + if(!empty( $this->params[ 'type' ] ) && $this->params[ 'type' ] == 'implementer') {
  157 + echo Html::a('Исполнитель', Url::current([ 'type' => 'implementer' ]));
  158 + } elseif(!empty( $this->params[ 'type' ] ) && $this->params[ 'type' ] == 'customer') {
  159 + echo Html::a('Заказчик', Url::current([ 'type' => NULL ]));
  160 + } else {
  161 + echo Html::a('Исполнитель', Url::current([ 'type' => NULL ]));
  162 + }
  163 + ?>
85 164 <div class="sidebar-droped-wr style">
86 165 <ul>
87   - <li><a href="#">Заказчик</a></li>
88   - <li style="display: none"><a href="#">Испонитель</a></li>
  166 + <li>
  167 + <?php
  168 + if(!empty( $this->params[ 'type' ] ) && $this->params[ 'type' ] == 'implementer') {
  169 + echo Html::a('Заказчик', Url::current([ 'type' => 'customer' ]));
  170 + } elseif(!empty( $this->params[ 'type' ] ) && $this->params[ 'type' ] == 'customer') {
  171 + echo Html::a('Исполнитель', Url::current([ 'type' => NULL ]));
  172 + } else {
  173 + echo Html::a('Заказчик', Url::current([ 'type' => 'customer' ]));
  174 + }
  175 + ?>
  176 + </li>
  177 + <li style="display: none">
  178 + <?php
  179 + if(!empty( $this->params[ 'type' ] ) && $this->params[ 'type' ] == 'implementer') {
  180 + echo Html::a('Исполнитель', Url::current([ 'type' => 'implementer' ]));
  181 + } elseif(!empty( $this->params[ 'type' ] ) && $this->params[ 'type' ] == 'customer') {
  182 + echo Html::a('Заказчик', Url::current([ 'type' => NULL ]));
  183 + } else {
  184 + echo Html::a('Исполнитель', Url::current([ 'type' => NULL ]));
  185 + }
  186 + ?>
89 187 </ul>
90 188 </div>
91 189 </li>
... ... @@ -94,16 +192,24 @@ $this-&gt;beginContent(&#39;@app/views/layouts/main.php&#39;);
94 192 <div class="performance-vacancy-sidebar-stars style">
95 193 <div class="rating">
96 194 <!--оценка-->
97   - <input type="hidden" class="val" value="5"/>
  195 + <input type="hidden" class="val" value="<?= $this->params[ 'company' ]->userInfo->rating ?>"/>
98 196 <!--количество голосов-->
99   - <input type="hidden" class="votes" value="12"/>
  197 + <input type="hidden" class="votes" value="1"/>
100 198 </div>
101 199 </div>
102   - <div class="performance-vacancy-sidebar-comm style">30 отзывов</div>
103   - <a href="#" class="performance-vacancy-sidebar-write style">написать отзыв</a>
  200 + <div class="performance-vacancy-sidebar-comm style"><?= count($this->params[ 'company' ]->comments) ?> мнений</div>
  201 + <?php
  202 + if($this->params[ 'company' ]->id != \Yii::$app->user->getId()) {
  203 + echo Html::a('написать мнение', [
  204 + 'company/review',
  205 + 'company_id' => $this->params[ 'company' ]->id,
  206 + 'type' => ( !empty( $this->params[ 'type' ] ) ) ? $this->params[ 'type' ] : NULL,
  207 + ], [ 'class' => 'performance-vacancy-sidebar-write style' ]);
  208 + }
  209 + ?>
104 210 </div>
105 211 <div class="performer-vacancy-sidebar-img style">
106   - <?= Html::img($this->params['company']->userInfo->image);?>
  212 + <?= Html::img($this->params[ 'company' ]->userInfo->image); ?>
107 213 </div>
108 214 </div>
109 215 </div>
... ... @@ -119,10 +225,10 @@ $this-&gt;beginContent(&#39;@app/views/layouts/main.php&#39;);
119 225 </div>
120 226 </div>
121 227 <script>
122   - $('div.rating').rating({
123   - fx: 'full',
124   - readOnly: 'true',
125   - url: 'rating.php'
126   - });
  228 + $('div.rating').rating(
  229 + {
  230 + fx : 'full', readOnly : 'true', url : 'rating.php'
  231 + }
  232 + );
127 233 </script>
128 234 <?php $this->endContent() ?>
129 235 \ No newline at end of file
... ...
frontend/views/layouts/gallery.php
... ... @@ -14,9 +14,36 @@ $this-&gt;beginContent(&#39;@app/views/layouts/main.php&#39;);
14 14 <div class="box-wr">
15 15 <div class="box-all">
16 16 <div class="blog-buttons-wr style">
17   - <a class="blog-buttons-offer" href="#">Предложить<br>проект</a>
18   - <?= Html::a('Предложить проект', Url::toRoute(['chat/message', 'user_id' => $this->params['user']->id]), ['class'=> 'blog-buttons-write'])?>
19   - <a class="blog-buttons-add-favorite" href="#">Добавить<br>в закладки</a>
  17 + <?php
  18 + if($this->params[ 'user' ]->id != \Yii::$app->user->getId()) {
  19 + // Offer project button
  20 + if(!empty( $this->params[ 'type' ] ) && $this->params[ 'type' ] == 'customer') {
  21 + echo Html::a('Предложить проект', [ '#' ], [
  22 + 'class' => 'blog-buttons-offer',
  23 + 'data-performer-id' => $this->params[ 'user' ]->id,
  24 + ]);
  25 + }
  26 + // Write message
  27 + echo Html::a('Написать сообщение', Url::toRoute([
  28 + 'chat/message',
  29 + 'user_id' => $this->params[ 'user' ]->id,
  30 + ]), [ 'class' => 'blog-buttons-write' ]);
  31 + // Bookmarks
  32 + if(!empty( \Yii::$app->user->identity )) {
  33 + if($this->params[ 'user' ]->isBookmarked) {
  34 + echo Html::a('Убрать из закладок', [ '#' ], [
  35 + 'class' => 'get-list artbox_bookmark_remove_performer',
  36 + 'data-id' => $this->params[ 'user' ]->id,
  37 + ]);
  38 + } else {
  39 + echo Html::a('Добавить в закладки', [ '#' ], [
  40 + 'class' => 'get-list artbox_bookmark_add_performer',
  41 + 'data-id' => $this->params[ 'user' ]->id,
  42 + ]);
  43 + }
  44 + }
  45 + }
  46 + ?>
20 47 </div>
21 48 </div>
22 49 </div>
... ... @@ -25,38 +52,70 @@ $this-&gt;beginContent(&#39;@app/views/layouts/main.php&#39;);
25 52 <div class="box-wr">
26 53 <div class="box-all">
27 54 <?php
28   - echo Menu::widget([
29   - 'options' => [
30   - 'class' => 'menu-content',
31   - ],
32   - 'activeCssClass' => 'active-menu-content',
33   - 'items' => [
34   - [
35   - 'label' => 'Общее',
36   - 'url' => ['performer/common', 'performer_id'=>$this->params['user']->id],
  55 + echo Menu::widget([
  56 + 'options' => [
  57 + 'class' => 'menu-content',
37 58 ],
38   - [
39   - 'label' => 'Портфолио',
40   - 'url' => ['performer/portfolio', 'performer_id'=>$this->params['user']->id],
  59 + 'activeCssClass' => 'active-menu-content',
  60 + 'items' => [
  61 + [
  62 + 'label' => 'Общее',
  63 + 'url' => [
  64 + 'performer/common',
  65 + 'performer_id' => $this->params[ 'user' ]->id,
  66 + 'type' => (!empty($this->params['type']))?$this->params['type']:null,
  67 + ],
  68 + ],
  69 + [
  70 + 'label' => 'Портфолио',
  71 + 'url' => [
  72 + 'performer/portfolio',
  73 + 'performer_id' => $this->params[ 'user' ]->id,
  74 + 'type' => (!empty($this->params['type']))?$this->params['type']:null,
  75 + ],
  76 + ],
  77 + [
  78 + 'label' => 'Заказанные работы',
  79 + 'url' => [
  80 + 'performer/projects',
  81 + 'performer_id' => $this->params[ 'user' ]->id,
  82 + 'type' => (!empty($this->params['type']))?$this->params['type']:null,
  83 + ],
  84 + ],
  85 + [
  86 + 'label' => 'Блог',
  87 + 'url' => [
  88 + 'performer/blog-list',
  89 + 'performer_id' => $this->params[ 'user' ]->id,
  90 + 'type' => (!empty($this->params['type']))?$this->params['type']:null,
  91 + ],
  92 + ],
  93 + [
  94 + 'label' => 'Мнения',
  95 + 'url' => [
  96 + 'performer/review',
  97 + 'performer_id' => $this->params[ 'user' ]->id,
  98 + 'type' => (!empty($this->params['type']))?$this->params['type']:null,
  99 + ],
  100 + ],
  101 + [
  102 + 'label' => 'Места работы',
  103 + 'url' => [
  104 + 'performer/workplace',
  105 + 'performer_id' => $this->params[ 'user' ]->id,
  106 + 'type' => (!empty($this->params['type']))?$this->params['type']:null,
  107 + ],
  108 + ],
  109 + [
  110 + 'label' => 'Галерея',
  111 + 'url' => [
  112 + 'performer/gallery',
  113 + 'performer_id' => $this->params[ 'user' ]->id,
  114 + 'type' => (!empty($this->params['type']))?$this->params['type']:null,
  115 + ],
  116 + ],
41 117 ],
42   - [
43   - 'label' => 'Блог',
44   - 'url' => ['performer/blog-list', 'performer_id'=>$this->params['user']->id],
45   - ],
46   - [
47   - 'label' => 'Отзывы',
48   - 'url' => ['performer/review', 'performer_id'=>$this->params['user']->id],
49   - ],
50   - [
51   - 'label' => 'Места работы',
52   - 'url' => ['performer/workplace', 'performer_id'=>$this->params['user']->id],
53   - ],
54   - [
55   - 'label' => 'Галерея',
56   - 'url' => ['performer/gallery', 'performer_id'=>$this->params['user']->id],
57   - ],
58   - ],
59   - ]);
  118 + ]);
60 119 ?>
61 120 </div>
62 121 </div>
... ... @@ -67,15 +126,42 @@ $this-&gt;beginContent(&#39;@app/views/layouts/main.php&#39;);
67 126 <div class="performer-vacancy-sidebar-left-wr gallery-page-sidebar">
68 127 <div class="performer-vacancy-sidebar-left">
69 128 <div class="performance-vacancy-sidebar-company-wr">
70   - <div class="performance-vacancy-sidebar-company-title style">Познякижилстрой</div>
  129 + <div class="performance-vacancy-sidebar-company-title style"><?=$this->params['user']->name?></div>
71 130 <div class="performance-vacancy-sidebar-company-job style">
72 131 <ul>
73 132 <li class="activejob">
74   - <a href="#">Исполнитель</a>
  133 + <?php
  134 + if(!empty($this->params['type']) && $this->params['type'] == 'implementer') {
  135 + echo Html::a('Исполнитель', Url::current(['type' => 'implementer']));
  136 + } elseif(!empty($this->params['type']) && $this->params['type'] == 'customer') {
  137 + echo Html::a('Заказчик', Url::current(['type' => null]));
  138 + } else {
  139 + echo Html::a('Исполнитель', Url::current(['type' => null]));
  140 + }
  141 + ?>
75 142 <div class="sidebar-droped-wr style">
76 143 <ul>
77   - <li><a href="#">Заказчик</a></li>
78   - <li style="display: none"><a href="#">Исполнитель</a></li>
  144 + <li>
  145 + <?php
  146 + if(!empty($this->params['type']) && $this->params['type'] == 'implementer') {
  147 + echo Html::a('Заказчик', Url::current(['type' => 'customer']));
  148 + } elseif(!empty($this->params['type']) && $this->params['type'] == 'customer') {
  149 + echo Html::a('Исполнитель', Url::current(['type' => null]));
  150 + } else {
  151 + echo Html::a('Заказчик', Url::current(['type' => 'customer']));
  152 + }
  153 + ?>
  154 + </li>
  155 + <li style="display: none">
  156 + <?php
  157 + if(!empty($this->params['type']) && $this->params['type'] == 'implementer') {
  158 + echo Html::a('Исполнитель', Url::current(['type' => 'implementer']));
  159 + } elseif(!empty($this->params['type']) && $this->params['type'] == 'customer') {
  160 + echo Html::a('Заказчик', Url::current(['type' => null]));
  161 + } else {
  162 + echo Html::a('Исполнитель', Url::current(['type' => null]));
  163 + }
  164 + ?>
79 165 </ul>
80 166 </div>
81 167 </li>
... ... @@ -84,13 +170,21 @@ $this-&gt;beginContent(&#39;@app/views/layouts/main.php&#39;);
84 170 <div class="performance-vacancy-sidebar-stars style">
85 171 <div class="rating">
86 172 <!--оценка-->
87   - <input type="hidden" class="val" value="5"/>
  173 + <input type="hidden" class="val" value="<?= $this->params[ 'user' ]->userInfo->rating ?>"/>
88 174 <!--количество голосов-->
89   - <input type="hidden" class="votes" value="12"/>
  175 + <input type="hidden" class="votes" value="1"/>
90 176 </div>
91 177 </div>
92   - <div class="performance-vacancy-sidebar-comm style">30 отзывов</div>
93   - <a href="#" class="performance-vacancy-sidebar-write style">написать отзыв</a>
  178 + <div class="performance-vacancy-sidebar-comm style"><?= count($this->params[ 'user' ]->comments) ?> мнений</div>
  179 + <?php
  180 + if($this->params[ 'user' ]->id != \Yii::$app->user->getId()) {
  181 + echo Html::a('написать мнение', [
  182 + 'performer/review',
  183 + 'performer_id' => $this->params[ 'user' ]->id,
  184 + 'type' => ( !empty( $this->params[ 'type' ] ) ) ? $this->params[ 'type' ] : NULL,
  185 + ], [ 'class' => 'performance-vacancy-sidebar-write style' ]);
  186 + }
  187 + ?>
94 188 </div>
95 189 <div class="performer-vacancy-sidebar-img style">
96 190 <?= Html::img($this->params['user']->userInfo->image);?>
... ...
frontend/views/layouts/performer.php
... ... @@ -19,27 +19,34 @@
19 19 <div class="box-wr">
20 20 <div class="box-all">
21 21 <div class="blog-buttons-wr style">
22   - <?= Html::a('Предложить проект', [ '#' ], [
23   - 'class' => 'blog-buttons-offer',
24   - 'data-performer-id' => $this->params[ 'user' ]->id,
25   - ]) ?>
26   - <?= Html::a('Написать сообщение', Url::toRoute([
27   - 'chat/message',
28   - 'user_id' => $this->params[ 'user' ]->id,
29   - ]), [ 'class' => 'blog-buttons-write' ]) ?>
30 22 <?php
31   - if(!empty( \Yii::$app->user->identity )) {
32   - if($this->params[ 'user' ]->isBookmarked) {
33   - echo Html::a('Убрать из закладок', [ '#' ], [
34   - 'class' => 'get-list artbox_bookmark_remove_performer',
35   - 'data-id' => $this->params[ 'user' ]->id,
36   - ]);
37   - } else {
38   - echo Html::a('Добавить в закладки', [ '#' ], [
39   - 'class' => 'get-list artbox_bookmark_add_performer',
40   - 'data-id' => $this->params[ 'user' ]->id,
  23 + if($this->params[ 'user' ]->id != \Yii::$app->user->getId()) {
  24 + // Offer project button
  25 + if(!empty( $this->params[ 'type' ] ) && $this->params[ 'type' ] == 'customer') {
  26 + echo Html::a('Предложить проект', [ '#' ], [
  27 + 'class' => 'blog-buttons-offer',
  28 + 'data-performer-id' => $this->params[ 'user' ]->id,
41 29 ]);
42 30 }
  31 + // Write message
  32 + echo Html::a('Написать сообщение', Url::toRoute([
  33 + 'chat/message',
  34 + 'user_id' => $this->params[ 'user' ]->id,
  35 + ]), [ 'class' => 'blog-buttons-write' ]);
  36 + // Bookmarks
  37 + if(!empty( \Yii::$app->user->identity )) {
  38 + if($this->params[ 'user' ]->isBookmarked) {
  39 + echo Html::a('Убрать из закладок', [ '#' ], [
  40 + 'class' => 'get-list artbox_bookmark_remove_performer',
  41 + 'data-id' => $this->params[ 'user' ]->id,
  42 + ]);
  43 + } else {
  44 + echo Html::a('Добавить в закладки', [ '#' ], [
  45 + 'class' => 'get-list artbox_bookmark_add_performer',
  46 + 'data-id' => $this->params[ 'user' ]->id,
  47 + ]);
  48 + }
  49 + }
43 50 }
44 51 ?>
45 52 </div>
... ... @@ -61,39 +68,41 @@
61 68 'url' => [
62 69 'performer/common',
63 70 'performer_id' => $this->params[ 'user' ]->id,
64   - 'type' => (!empty($this->params['type']))?$this->params['type']:null,
  71 + 'type' => ( !empty( $this->params[ 'type' ] ) ) ? $this->params[ 'type' ] : NULL,
65 72 ],
66 73 ],
67 74 [
68   - 'label' => 'Портфолио',
69   - 'url' => [
  75 + 'label' => 'Портфолио',
  76 + 'url' => [
70 77 'performer/portfolio',
71 78 'performer_id' => $this->params[ 'user' ]->id,
72   - 'type' => (!empty($this->params['type']))?$this->params['type']:null,
  79 + 'type' => ( !empty( $this->params[ 'type' ] ) ) ? $this->params[ 'type' ] : NULL,
73 80 ],
  81 + 'visible' => ( empty( $this->params[ 'type' ] ) || $this->params[ 'type' ] == 'implementer' ) ? true : false,
74 82 ],
75 83 [
76   - 'label' => 'Заказанные работы',
77   - 'url' => [
  84 + 'label' => 'Заказанные работы',
  85 + 'url' => [
78 86 'performer/projects',
79 87 'performer_id' => $this->params[ 'user' ]->id,
80   - 'type' => (!empty($this->params['type']))?$this->params['type']:null,
  88 + 'type' => ( !empty( $this->params[ 'type' ] ) ) ? $this->params[ 'type' ] : NULL,
81 89 ],
  90 + 'visible' => ( !empty( $this->params[ 'type' ] ) && $this->params[ 'type' ] == 'customer' ) ? true : false,
82 91 ],
83 92 [
84 93 'label' => 'Блог',
85 94 'url' => [
86 95 'performer/blog-list',
87 96 'performer_id' => $this->params[ 'user' ]->id,
88   - 'type' => (!empty($this->params['type']))?$this->params['type']:null,
  97 + 'type' => ( !empty( $this->params[ 'type' ] ) ) ? $this->params[ 'type' ] : NULL,
89 98 ],
90 99 ],
91 100 [
92   - 'label' => 'Отзывы',
  101 + 'label' => 'Мнения',
93 102 'url' => [
94 103 'performer/review',
95 104 'performer_id' => $this->params[ 'user' ]->id,
96   - 'type' => (!empty($this->params['type']))?$this->params['type']:null,
  105 + 'type' => ( !empty( $this->params[ 'type' ] ) ) ? $this->params[ 'type' ] : NULL,
97 106 ],
98 107 ],
99 108 [
... ... @@ -101,7 +110,7 @@
101 110 'url' => [
102 111 'performer/workplace',
103 112 'performer_id' => $this->params[ 'user' ]->id,
104   - 'type' => (!empty($this->params['type']))?$this->params['type']:null,
  113 + 'type' => ( !empty( $this->params[ 'type' ] ) ) ? $this->params[ 'type' ] : NULL,
105 114 ],
106 115 ],
107 116 [
... ... @@ -109,7 +118,7 @@
109 118 'url' => [
110 119 'performer/gallery',
111 120 'performer_id' => $this->params[ 'user' ]->id,
112   - 'type' => (!empty($this->params['type']))?$this->params['type']:null,
  121 + 'type' => ( !empty( $this->params[ 'type' ] ) ) ? $this->params[ 'type' ] : NULL,
113 122 ],
114 123 ],
115 124 ],
... ... @@ -128,12 +137,38 @@
128 137 <div class="performance-vacancy-sidebar-company-job style">
129 138 <ul>
130 139 <li class="activejob">
131   - <a href="#">Испонитель</a>
  140 + <?php
  141 + if(!empty( $this->params[ 'type' ] ) && $this->params[ 'type' ] == 'implementer') {
  142 + echo Html::a('Исполнитель', Url::current([ 'type' => 'implementer' ]));
  143 + } elseif(!empty( $this->params[ 'type' ] ) && $this->params[ 'type' ] == 'customer') {
  144 + echo Html::a('Заказчик', Url::current([ 'type' => NULL ]));
  145 + } else {
  146 + echo Html::a('Исполнитель', Url::current([ 'type' => NULL ]));
  147 + }
  148 + ?>
132 149 <div class="sidebar-droped-wr style">
133 150 <ul>
134   - <li><a href="#">Заказчик</a></li>
  151 + <li>
  152 + <?php
  153 + if(!empty( $this->params[ 'type' ] ) && $this->params[ 'type' ] == 'implementer') {
  154 + echo Html::a('Заказчик', Url::current([ 'type' => 'customer' ]));
  155 + } elseif(!empty( $this->params[ 'type' ] ) && $this->params[ 'type' ] == 'customer') {
  156 + echo Html::a('Исполнитель', Url::current([ 'type' => NULL ]));
  157 + } else {
  158 + echo Html::a('Заказчик', Url::current([ 'type' => 'customer' ]));
  159 + }
  160 + ?>
  161 + </li>
135 162 <li style="display: none">
136   - <a href="#">Испонитель</a></li>
  163 + <?php
  164 + if(!empty( $this->params[ 'type' ] ) && $this->params[ 'type' ] == 'implementer') {
  165 + echo Html::a('Исполнитель', Url::current([ 'type' => 'implementer' ]));
  166 + } elseif(!empty( $this->params[ 'type' ] ) && $this->params[ 'type' ] == 'customer') {
  167 + echo Html::a('Заказчик', Url::current([ 'type' => NULL ]));
  168 + } else {
  169 + echo Html::a('Исполнитель', Url::current([ 'type' => NULL ]));
  170 + }
  171 + ?>
137 172 </ul>
138 173 </div>
139 174 </li>
... ... @@ -147,12 +182,16 @@
147 182 <input type="hidden" class="votes" value="1"/>
148 183 </div>
149 184 </div>
150   - <div class="performance-vacancy-sidebar-comm style"><?= count($this->params[ 'user' ]->comments) ?> отзывов</div>
151   - <?= Html::a('написать отзыв', [
152   - 'performer/review',
153   - 'performer_id' => $this->params[ 'user' ]->id,
154   - 'type' => (!empty($this->params['type']))?$this->params['type']:null,
155   - ], [ 'class' => 'performance-vacancy-sidebar-write style' ]) ?>
  185 + <div class="performance-vacancy-sidebar-comm style"><?= count($this->params[ 'user' ]->comments) ?> мнений</div>
  186 + <?php
  187 + if($this->params[ 'user' ]->id != \Yii::$app->user->getId()) {
  188 + echo Html::a('написать мнение', [
  189 + 'performer/review',
  190 + 'performer_id' => $this->params[ 'user' ]->id,
  191 + 'type' => ( !empty( $this->params[ 'type' ] ) ) ? $this->params[ 'type' ] : NULL,
  192 + ], [ 'class' => 'performance-vacancy-sidebar-write style' ]);
  193 + }
  194 + ?>
156 195 </div>
157 196 <div class="performer-vacancy-sidebar-img style">
158 197 <?= Html::img($this->params[ 'user' ]->userInfo->image); ?>
... ... @@ -178,28 +217,66 @@
178 217 </li>
179 218 <li><img src="/images/sidebar-ico/ico-3.png" alt=""/>
180 219 <div class="sidebarvievstxt">
181   - <span class="sidebar-views-txt">Последний визит:<br/></span><?= $this->params[ 'user' ]->userInfo->lastVisit ?>
182   - </div>
183   - </li>
184   - <li><img src="/images/sidebar-ico/ico-10.png" alt=""/>
185   - <div class="sidebarvievstxt">
186   - <span class="sidebar-views-txt">Трудовой стаж:<br/></span><?= $this->params[ 'user' ]->userInfo->experience ?>
  220 + <span class="sidebar-views-txt">Последний визит:<br/></span>
  221 + <?php
  222 + if($this->params[ 'user' ]->isOnline) {
  223 + echo 'Онлайн';
  224 + } else {
  225 + echo $this->params[ 'user' ]->userInfo->lastVisitCabinet;
  226 + }
  227 + ?>
187 228 </div>
188 229 </li>
189   - <li><img src="/images/sidebar-ico/ico-11.png" alt=""/>
  230 + <li>
  231 + <img src="/images/sidebar-ico/ico-10.png" alt=""/>
190 232 <div class="sidebarvievstxt">
191   - <span class="sidebar-views-txt">Звание в МФП:<br/></span><?= $this->params[ 'user' ]->userInfo->rank ?>
  233 + <span class="sidebar-views-txt">Трудовой стаж:<br/></span>
  234 + <?php
  235 + if(!empty( $this->params[ 'user' ]->userInfo->experience )) {
  236 + echo 'С ' . $this->params[ 'user' ]->userInfo->experience . ' года';
  237 + } else {
  238 + echo 'Не указано';
  239 + }
  240 + ?>
192 241 </div>
193 242 </li>
  243 + <?php
  244 + // Predefined in DB variable rank will be used further
  245 + if(!empty( $this->params[ 'user' ]->userInfo->member )) {
  246 + ?>
  247 + <li>
  248 + <img src="/images/sidebar-ico/ico-11.png" alt=""/>
  249 + <div class="sidebarvievstxt">
  250 + <span class="sidebar-views-txt">Звание в МФП:<br/></span><?= \Yii::$app->formatter->asBoolean($this->params[ 'user' ]->userInfo->member) ?>
  251 + </div>
  252 + </li>
  253 + <?php
  254 + }
  255 + ?>
194 256 <li><img src="/images/sidebar-ico/ico_money.png" alt=""/>
195 257 <div class="sidebarvievstxt">
196 258 <span class="sidebar-views-txt">Стоимость работ:<br/></span>
197   - <?= $this->params[ 'user' ]->userInfo->salary . ' ' . $this->params[ 'user' ]->userInfo->currency->label ?>
  259 + <?php
  260 + if(!empty( $this->params[ 'user' ]->userInfo->salary )) {
  261 + echo $this->params[ 'user' ]->userInfo->salary . ' ' . $this->params[ 'user' ]->userInfo->currency->label;
  262 + } else {
  263 + echo 'Не указано';
  264 + }
  265 + ?>
198 266 </div>
199 267 </li>
200   - <li><img src="/images/sidebar-ico/ico-13.png" alt=""/>
201   - <div class="sidebarvievstxt"><?= implode(', ', ArrayHelper::getColumn($this->params[ 'user' ]->payments, 'name')) ?></div>
202   - </li>
  268 + <?php
  269 + if(!empty( $this->params[ 'user' ]->payments )) {
  270 + ?>
  271 + <li>
  272 + <img src="/images/sidebar-ico/ico-13.png" alt=""/>
  273 + <div class="sidebarvievstxt">
  274 + <?= implode(', ', ArrayHelper::getColumn($this->params[ 'user' ]->payments, 'name')) ?>
  275 + </div>
  276 + </li>
  277 + <?php
  278 + }
  279 + ?>
203 280 <?php
204 281 if(!empty( $this->params[ 'user' ]->currentJob )) {
205 282 ?>
... ...
frontend/views/patrial/show_site.php
1 1 <?php foreach($sites as $site ):?>
2   - <?php if(!empty($phone['phone'])): ?>
  2 + <?php if(!empty($site['site'])): ?>
3 3 <div class="style">
4 4 <div class="profile-site">
5 5 <img src="/images/ico-site.png" alt=""/>
... ...
frontend/views/patrial/social_list.php
1 1 <?php
2 2 use yii\helpers\Html;
  3 + use yii\helpers\Url;
  4 +
  5 + if(!empty($params['company'])) {
  6 + $type = 'company';
  7 + } elseif(!empty($params['user'])) {
  8 + $type = 'user';
  9 + }
3 10 ?>
4 11 <div class="performer-vacancy-sidebar-soc style">
5 12 <ul>
6   - <?php if(!empty($params['company']->userInfo->social_fb)){?>
  13 + <?php if(!empty($params[$type]->userInfo->social_fb)){?>
7 14 <li>
8   - <?= Html::a(Html::img('/images/ico-fb.png'),$params['company']->userInfo->social_fb,['target'=>'_blank']); ?>
  15 + <?= Html::a(Html::img('/images/ico-fb.png'),$params[$type]->userInfo->social_fb,['target'=>'_blank']); ?>
9 16 </li>
10 17 <?php } ?>
11 18  
12   - <?php if(!empty($params['company']->userInfo->social_t)){?>
  19 + <?php if(!empty($params[$type]->userInfo->social_t)){?>
13 20 <li>
14   - <?= Html::a(Html::img('/images/ico-tw.png'),$params['company']->userInfo->social_t,['target'=>'_blank']); ?>
  21 + <?= Html::a(Html::img('/images/ico-tw.png'),$params[$type]->userInfo->social_t,['target'=>'_blank']); ?>
15 22 </li>
16 23 <?php } ?>
17 24  
18   - <?php if(!empty($params['company']->userInfo->social_in)){?>
  25 + <?php if(!empty($params[$type]->userInfo->social_in)){?>
19 26 <li>
20   - <?= Html::a(Html::img('/images/ico-in.png'),$params['company']->userInfo->social_in,['target'=>'_blank']); ?>
  27 + <?= Html::a(Html::img('/images/ico-in.png'),$params[$type]->userInfo->social_in,['target'=>'_blank']); ?>
21 28 </li>
22 29 <?php } ?>
23 30  
24   - <?php if(!empty($params['company']->userInfo->social_vk)){?>
  31 + <?php if(!empty($params[$type]->userInfo->social_vk)){?>
25 32 <li>
26   - <?= Html::a(Html::img('/images/ico-vk.png'),$params['company']->userInfo->social_vk,['target'=>'_blank']); ?>
  33 + <?= Html::a(Html::img('/images/ico-vk.png'),$params[$type]->userInfo->social_vk,['target'=>'_blank']); ?>
27 34 </li>
28 35 <?php } ?>
29 36 </ul>
... ...
frontend/views/performer/_blog_list_view.php
1 1 <?php
2 2 /**
3 3 * @var Blog $model
  4 + * @var View $parent_view
4 5 */
5 6 use common\models\Blog;
6   - use common\modules\comment\models\Comment;
7 7 use frontend\helpers\TextHelper;
8 8 use yii\helpers\Html;
9 9 use yii\helpers\Url;
  10 + use yii\web\View;
10 11  
11 12 ?>
12 13 <div class="blog-post-wr">
... ... @@ -15,6 +16,7 @@
15 16 'performer/blog-view',
16 17 'performer_id' => $this->params[ 'user' ]->id,
17 18 'link' => $model->link,
  19 + 'type' => ( !empty( $this->params[ 'type' ] ) ) ? $this->params[ 'type' ] : NULL,
18 20 ]), [ 'class' => 'blog-new-link' ]); ?>
19 21 </div>
20 22 <div class="blog-post-icons-wr style">
... ... @@ -36,6 +38,7 @@
36 38 '/performer/blog-view',
37 39 'performer_id' => $this->params[ 'user' ]->id,
38 40 'link' => $model->link,
  41 + 'type' => ( !empty( $this->params[ 'type' ] ) ) ? $this->params[ 'type' ] : NULL,
39 42 ])); ?>
40 43 <?= TextHelper::truncateHtmlText($model->description, 1300) ?>
41 44 </div>
... ... @@ -43,5 +46,6 @@
43 46 'performer/blog-view',
44 47 'performer_id' => $this->params[ 'user' ]->id,
45 48 'link' => $model->link,
  49 + 'type' => ( !empty( $this->params[ 'type' ] ) ) ? $this->params[ 'type' ] : NULL,
46 50 ]), [ 'class' => 'blog-post-see-all style' ]); ?>
47 51 </div>
48 52 \ No newline at end of file
... ...
frontend/views/performer/_portfolio_list_view.php
1 1 <?php
2 2 /**
3 3 * @var Portfolio $model
  4 + * @var View $parent_view
4 5 */
5 6 use common\models\Portfolio;
6 7 use yii\helpers\ArrayHelper;
7 8 use yii\helpers\Html;
8 9 use yii\helpers\StringHelper;
9   -use yii\helpers\Url;
10   -
  10 + use yii\helpers\Url;
  11 + use yii\web\View;
11 12 ?>
12 13 <div class="portfolio-project-blocks-wr">
13 14 <div class="portfolio-project-blocks-img-title">
... ... @@ -16,6 +17,7 @@ use yii\helpers\Url;
16 17 'performer/portfolio-view',
17 18 'performer_id' => $model->user_id,
18 19 'portfolio_id' => $model->portfolio_id,
  20 + 'type' => (!empty($this->params['type']))?$this->params['type']:null,
19 21 ])); ?>
20 22 </div>
21 23 <div class="portfolio-project-blocks-title-wr">
... ... @@ -24,6 +26,7 @@ use yii\helpers\Url;
24 26 'performer/portfolio-view',
25 27 'performer_id' => $model->user_id,
26 28 'portfolio_id' => $model->portfolio_id,
  29 + 'type' => (!empty($this->params['type']))?$this->params['type']:null,
27 30 ])) ?>
28 31 </div>
29 32 </div>
... ...
frontend/views/performer/blog-list.php
... ... @@ -18,6 +18,7 @@
18 18 'dataProvider' => $blog,
19 19 'itemView' => '_blog_list_view',
20 20 'summary' => '',
  21 + 'viewParams' => [ 'parent_view' => $this ],
21 22 ]); ?>
22 23 </div>
23 24 <div class="navi-buttons-wr style">
... ...
frontend/views/performer/common.php
... ... @@ -5,7 +5,7 @@
5 5 use \yii\helpers\Html;
6 6  
7 7 /* @var yii\web\View $this
8   - * @var User $user
  8 + * @var User $user
9 9 * @var array $developments
10 10 * @var array $educations
11 11 * @var array $courses
... ... @@ -13,33 +13,41 @@
13 13 $this->params[ 'user' ] = $user;
14 14  
15 15 $this->title = 'My Yii Application';
  16 +
  17 + $georgaphy = implode(',', array_filter(ArrayHelper::getColumn($user->portfolios, 'city')));
16 18 ?>
17 19 <div class="proektant-profile-content">
18   - <div class="proektant-profile-hidden-txt">
19   - <?= $user->userInfo->about ?>
20   - </div>
21   - <a href="#" class="profile-see-all"></a>
22 20 <?php
23   - if(!empty($educations)) {
24   - ?>
25   - <div class="proektant-profile-courses-wr style">
26   - <div class="proektant-profile-courses">
27   - <div class="proektant-profile-courses-title">Образование:</div>
28   - <?php
29   - foreach($educations as $education) {
30   - ?>
31   - <div class="proektant-profile-courses-year"><?= isset( $education[ 'year_from' ] ) ? $education[ 'year_from' ] : '' ?>-<?= isset( $education[ 'year_to' ] ) ? $education[ 'year_to' ] : 'настоящее время' ?></div>
32   - <div class="proektant-profile-courses-content"><?= isset( $education[ 'name' ] ) ? $education[ 'name' ] : '' ?></div>
33   - <?php
34   - }
  21 + if(!empty( $user->userInfo->about )) {
35 22 ?>
36   - </div>
37   - </div>
  23 + <div class="proektant-profile-hidden-txt">
  24 + <?= $user->userInfo->about ?>
  25 + </div>
  26 + <a href="#" class="profile-see-all"></a>
  27 + <?php
  28 + }
  29 + ?>
38 30 <?php
39   - }
  31 + if(!empty( $educations )) {
  32 + ?>
  33 + <div class="proektant-profile-courses-wr style">
  34 + <div class="proektant-profile-courses">
  35 + <div class="proektant-profile-courses-title">Образование:</div>
  36 + <?php
  37 + foreach($educations as $education) {
  38 + ?>
  39 + <div class="proektant-profile-courses-year"><?= isset( $education[ 'year_from' ] ) ? $education[ 'year_from' ] : '' ?>-<?= isset( $education[ 'year_to' ] ) ? $education[ 'year_to' ] : 'настоящее время' ?></div>
  40 + <div class="proektant-profile-courses-content"><?= isset( $education[ 'name' ] ) ? $education[ 'name' ] : '' ?></div>
  41 + <?php
  42 + }
  43 + ?>
  44 + </div>
  45 + </div>
  46 + <?php
  47 + }
40 48 ?>
41 49 <?php
42   - if(!empty($developments)) {
  50 + if(!empty( $developments )) {
43 51 ?>
44 52 <div class="proektant-profile-courses-wr style">
45 53 <div class="proektant-profile-courses">
... ... @@ -58,7 +66,7 @@
58 66 }
59 67 ?>
60 68 <?php
61   - if(!empty($courses)) {
  69 + if(!empty( $courses )) {
62 70 ?>
63 71 <div class="proektant-profile-courses-wr style">
64 72 <div class="proektant-profile-courses">
... ... @@ -120,10 +128,24 @@
120 128 </div>
121 129 <div class="profile-features style">
122 130 <ul>
123   - <li>
124   - <span>География работ: </span><?= implode(',', array_filter(ArrayHelper::getColumn($user->portfolios, 'city'))) ?>
  131 + <?php
  132 + if(!empty( $georgaphy )) {
  133 + ?>
  134 + <li>
  135 + <span>География работ: </span><?= $georgaphy ?>
  136 + </li>
  137 + <?php
  138 + }
  139 + ?>
  140 + <li><span>Местонахождение: </span>
  141 + <?php
  142 + if(!empty( $user->userInfo->city )) {
  143 + echo $user->userInfo->city;
  144 + } else {
  145 + echo 'Не указано';
  146 + }
  147 + ?>
125 148 </li>
126   - <li><span>Местонахождение: </span><?= $user->userInfo->city ?></li>
127 149 <li>
128 150 <div class="features-tags features-tags-profile">
129 151 <?php foreach($user->specializations as $specialization): ?>
... ... @@ -131,25 +153,69 @@
131 153 <?php endforeach; ?>
132 154 </div>
133 155 </li>
134   - <li><span>Работа с программами: </span><?= $soft ?></li>
135   - <li><span>Гарантия: </span><?= $user->userInfo->guarantee ?> года</li>
136   - <li>
137   - <span>Договор: </span><?= \Yii::$app->formatter->asBoolean($user->userInfo->contract) ?>
138   - </li>
139   - <li>
140   - <span>Смета: </span><?= \Yii::$app->formatter->asBoolean($user->userInfo->estimate) ?>
141   - </li>
142   - <li>
143   - <span>Закупка стройматериалов: </span><?= \Yii::$app->formatter->asBoolean($user->userInfo->purchase) ?>
144   - </li>
145   - <li>
146   - <span>Доставка стройматериалов: </span><?= \Yii::$app->formatter->asBoolean($user->userInfo->delivery) ?>
  156 + <?php
  157 + if(!empty( $soft )) {
  158 + ?>
  159 + <li><span>Работа с программами: </span><?= $soft ?></li>
  160 + <?php
  161 + }
  162 + ?>
  163 + <?php
  164 + if(!empty( $user->userInfo->guarantee )) {
  165 + ?>
  166 + <li><span>Гарантия: </span><?= $user->userInfo->guarantee ?> года</li>
  167 + <?php
  168 + }
  169 + ?>
  170 + <?php
  171 + if(!empty( $user->userInfo->contract )) {
  172 + ?>
  173 + <li>
  174 + <span>Договор: </span><?= \Yii::$app->formatter->asBoolean($user->userInfo->contract) ?>
  175 + </li>
  176 + <?php
  177 + }
  178 + ?>
  179 + <?php
  180 + if(!empty( $user->userInfo->estimate )) {
  181 + ?>
  182 + <li>
  183 + <span>Смета: </span><?= \Yii::$app->formatter->asBoolean($user->userInfo->estimate) ?>
  184 + </li>
  185 + <?php
  186 + }
  187 + ?>
  188 + <?php
  189 + if(!empty( $user->userInfo->purchase )) {
  190 + ?>
  191 + <li>
  192 + <span>Закупка стройматериалов: </span><?= \Yii::$app->formatter->asBoolean($user->userInfo->purchase) ?>
  193 + </li>
  194 + <?php
  195 + }
  196 + ?>
  197 + <?php
  198 + if(!empty( $user->userInfo->delivery )) {
  199 + ?>
  200 + <li>
  201 + <span>Доставка стройматериалов: </span><?= \Yii::$app->formatter->asBoolean($user->userInfo->delivery) ?>
  202 + </li>
  203 + <?php
  204 + }
  205 + ?>
  206 + <li><span>Предоплата:</span>
  207 + <?php
  208 + if(!empty( $user->userInfo->prepayment )) {
  209 + echo $user->userInfo->prepayment . '%';
  210 + } else {
  211 + echo 'без предоплаты';
  212 + }
  213 + ?>
147 214 </li>
148   - <li><span>Предоплата: </span><?= $user->userInfo->prepayment ?> %</li>
149 215 </ul>
150 216 </div>
151 217 <div class="profile-comments style">
152   - <div class="company-performer-comm-title style">Отзывов: <?= count($user->comments) ?></div>
  218 + <div class="company-performer-comm-title style">Мнений: <?= count($user->comments) ?></div>
153 219 <div class="company-performer-comments-wr style">
154 220 <?php
155 221 $count = ( count($user->comments) > 4 ) ? 4 : count($user->comments);
... ... @@ -168,8 +234,8 @@
168 234 <?php
169 235 }
170 236 ?>
171   - <div class="company-performer-comments-autor">Отзыв от: <?= $user->comments[$i]->user->name ?></div>
172   - <div class="company-performer-comments-txt"><?= $user->comments[$i]->text ?></div>
  237 + <div class="company-performer-comments-autor">Мнение от: <?= $user->comments[ $i ]->user->name ?></div>
  238 + <div class="company-performer-comments-txt"><?= $user->comments[ $i ]->text ?></div>
173 239 <a href="#" class="company-comm-see-all"><span>Развернуть</span></a>
174 240 </div>
175 241 <?php
... ... @@ -178,7 +244,11 @@
178 244 </div>
179 245 <div class="company-performer-comm-see-all-butt style">
180 246 <?php
181   - echo Html::a('Читать все отзывы', ['performer/review', 'performer_id' => $user->id]);
  247 + echo Html::a('Читать все мнения', [
  248 + 'performer/review',
  249 + 'performer_id' => $user->id,
  250 + 'type' => ( !empty( $this->params[ 'type' ] ) ) ? $this->params[ 'type' ] : NULL,
  251 + ]);
182 252 ?>
183 253 </div>
184 254 </div>
... ...
frontend/views/performer/portfolio.php
1 1 <?php
2 2  
3   -use yii\helpers\ArrayHelper;
4   -use \yii\helpers\Html;
5   -use yii\helpers\Url;
6   -use yii\widgets\ListView;
7   -
8   -
9   -/* @var $this yii\web\View
10   -* @var $portfolio yii\data\ArrayDataProvider
11   - */
12   -$this->params['user'] = $user;
13   -$this->title = 'My Yii Application';
  3 + use yii\helpers\ArrayHelper;
  4 + use \yii\helpers\Html;
  5 + use yii\helpers\Url;
  6 + use yii\widgets\ListView;
  7 +
  8 + /* @var $this yii\web\View
  9 + * @var $portfolio yii\data\ArrayDataProvider
  10 + */
  11 + $this->params[ 'user' ] = $user;
  12 + $this->title = 'My Yii Application';
14 13 ?>
15 14 <div class="performer-vacancy-vacant-title-reclam-wr style">
16 15  
17 16 <div class="portfolio-project-wr style">
18 17 <div class="workplace-title style"><p>Проектов: <?= $portfolio->totalCount ?></p></div>
19 18 <div class="portfolio-project-tags style">
20   - <?= Html::a("Все ({$count})", ['performer/portfolio', 'performer_id'=> $user->id],
21   - ['class'=> !isset($filter_id) || empty($filter_id) ? "active-tag" : ""]);?>
  19 + <?= Html::a("Все ({$count})", [
  20 + 'performer/portfolio',
  21 + 'performer_id' => $user->id,
  22 + ], [ 'class' => !isset( $filter_id ) || empty( $filter_id ) ? "active-tag" : "" ]); ?>
22 23 <a href="#" class="active-tag"></a>
23 24 <?php foreach($filters as $filter): ?>
24   - <?= Html::a("{$filter->specialization->specialization_name} ({$filter->count})",
25   - Url::toRoute(['performer/portfolio-filter', 'performer_id'=> $user->id, 'filter' => $filter->specialization->specialization_id]),
26   - ['class'=> isset($filter_id) && $filter->specialization->specialization_id == $filter_id ? "active-tag" : ""]);?>
  25 + <?= Html::a("{$filter->specialization->specialization_name} ({$filter->count})", Url::toRoute([
  26 + 'performer/portfolio-filter',
  27 + 'performer_id' => $user->id,
  28 + 'filter' => $filter->specialization->specialization_id,
  29 + 'type' => ( !empty( $this->params[ 'type' ] ) ) ? $this->params[ 'type' ] : NULL,
  30 + ]), [ 'class' => isset( $filter_id ) && $filter->specialization->specialization_id == $filter_id ? "active-tag" : "" ]); ?>
27 31 <?php endforeach; ?>
28 32  
29 33 </div>
... ... @@ -31,13 +35,12 @@ $this-&gt;title = &#39;My Yii Application&#39;;
31 35  
32 36 <div class="style">
33 37 <div class="portfolio-project-blocks-wrapper">
34   - <?=
35   - ListView::widget( [
  38 + <?= ListView::widget([
36 39 'dataProvider' => $portfolio,
37   - 'itemView'=>'_portfolio_list_view',
38   - 'layout' => "{items}\n<div class='navi-buttons-wr style'>{pager}</div>"
39   - ] );
40   - ?>
  40 + 'itemView' => '_portfolio_list_view',
  41 + 'layout' => "{items}\n<div class='navi-buttons-wr style'>{pager}</div>",
  42 + 'viewParams' => [ 'parent_view' => $this ],
  43 + ]); ?>
41 44  
42 45 </div>
43 46 </div>
... ...