diff --git a/common/behaviors/ShowImage.php b/common/behaviors/ShowImage.php index 0198027..2b9b812 100644 --- a/common/behaviors/ShowImage.php +++ b/common/behaviors/ShowImage.php @@ -9,7 +9,7 @@ class ShowImage extends Behavior { function minImg($dir, $width, $height=null){ if(empty($dir)){ - return $dir; + return '/images/avatar-bg.png'; } if($width=='original'){ diff --git a/common/models/User.php b/common/models/User.php index 8217fd4..052010f 100755 --- a/common/models/User.php +++ b/common/models/User.php @@ -436,7 +436,19 @@ */ public function getAddress() { - return $this->userInfo->country . ', ' . $this->userInfo->city . ', ' . $this->companyInfo->street . ', ' . $this->companyInfo->house; + $address = $this->userInfo->city; + if(!empty($this->userInfo->county)) { + $address = $this->userInfo->country.', '.$address; + } + if($this->type == 2) { + if(!empty($this->companyInfo->street)) { + $address .= ', '.$this->companyInfo->street; + } + if(!empty($this->companyInfo->house)) { + $address .= ', '.$this->companyInfo->house; + } + } + return $address; } /** diff --git a/common/models/Vacancy.php b/common/models/Vacancy.php index 60e6881..e1ee57f 100644 --- a/common/models/Vacancy.php +++ b/common/models/Vacancy.php @@ -236,4 +236,9 @@ $this->specializationInput = $value; } + public function getUser() + { + return $this->hasOne(User::className(), ['id' => 'user_id']); + } + } diff --git a/common/modules/comment/widgets/CommentWidget.php b/common/modules/comment/widgets/CommentWidget.php index bd7b278..d1af137 100644 --- a/common/modules/comment/widgets/CommentWidget.php +++ b/common/modules/comment/widgets/CommentWidget.php @@ -278,6 +278,8 @@ if($this->comment_class->rating->load($data) && $this->comment_class->rating->save()) { $this->isSuccess = true; } + } else { + $this->isSuccess = true; } } } diff --git a/common/modules/comment/widgets/views/_project_comment_view.php b/common/modules/comment/widgets/views/_project_comment_view.php index 81f2812..2ddc4ef 100644 --- a/common/modules/comment/widgets/views/_project_comment_view.php +++ b/common/modules/comment/widgets/views/_project_comment_view.php @@ -1,5 +1,6 @@
- userInfo->image) ?> + userInfo->image)) { + echo Html::img($user->userInfo->image); + } else { + echo Html::img('/images/avatar-bg.png'); + } + ?>
@@ -62,7 +69,7 @@
- link, [ 'class' => 'tender-see-profile style' ]) ?> + link, [ 'class' => 'tender-see-profile style', 'target' => '_blank' ]) ?>
@@ -78,10 +85,13 @@
name ?>
-
- - -
+ 'rating_review_comment', + 'value' => $user->userInfo->rating, + 'pluginOptions' => ['displayOnly' => true, 'size' => 'xxs'] + ]); + ?> comments) . ' отзывов', $user->getLink('review'), [ 'class' => 'link-to-comm' ]) ?>
diff --git a/common/modules/comment/widgets/views/_review_comment_view.php b/common/modules/comment/widgets/views/_review_comment_view.php index c7e9689..1fdd831 100644 --- a/common/modules/comment/widgets/views/_review_comment_view.php +++ b/common/modules/comment/widgets/views/_review_comment_view.php @@ -1,6 +1,7 @@ formatter->asDate($model->date_add, 'php:d.m.Y') ?>
rating )) { - ?> -
- - -
- 'rating_review_comment', + 'value' => $model->rating->value, + 'pluginOptions' => ['displayOnly' => true] + ]); } ?>
@@ -54,15 +54,6 @@ ?>
isNewRecord) { - $this->registerJs("$('div.rating').rating( - { - fx : 'full', readOnly : 'true', url : 'rating.php' - } - );"); - } -?> - diff --git a/common/modules/comment/widgets/views/form-comment-review.php b/common/modules/comment/widgets/views/form-comment-review.php index efd8760..28c0bbd 100644 --- a/common/modules/comment/widgets/views/form-comment-review.php +++ b/common/modules/comment/widgets/views/form-comment-review.php @@ -11,7 +11,6 @@ use yii\web\View; use yii\widgets\ActiveForm; use yii\helpers\Html; - $this->registerLinkTag(['rel' => 'stylesheet', 'href' => 'https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css']); ?> hasRating()) { - ?> -
- - - - -
- 'rating_project_comment', + 'value' => $rating->value, + 'pluginOptions' => ['displayOnly' => true] + ]); } ?>
diff --git a/frontend/controllers/SearchController.php b/frontend/controllers/SearchController.php index 744e471..8a58e08 100755 --- a/frontend/controllers/SearchController.php +++ b/frontend/controllers/SearchController.php @@ -4,36 +4,19 @@ namespace frontend\controllers; use common\models\Currency; use common\models\CustomerSearch; use common\models\Payment; -use common\models\Project; use common\models\Specialization; use common\models\TenderSearch; -use common\models\UserInfo; -use common\models\Vacancy; use frontend\models\SearchPerformerForm; use frontend\models\SearchVacancyForm; use Yii; -use common\models\LoginForm; -use frontend\models\PasswordResetRequestForm; -use frontend\models\ResetPasswordForm; -use frontend\models\SignupForm; -use frontend\models\ContactForm; use frontend\models\Options; use frontend\models\OptionValues; -use yii\base\InvalidParamException; use yii\data\ActiveDataProvider; use yii\data\Pagination; -use yii\helpers\ArrayHelper; -use yii\web\BadRequestHttpException; use yii\web\Controller; -use yii\filters\VerbFilter; -use yii\filters\AccessControl; use frontend\models\OptionsToValues; -use yii\validators\EmailValidator; -use common\models\User; -use yii\helpers\VarDumper; use common\models\Page; use frontend\models\Option; -use common\models\Social; /** * Site controller @@ -110,8 +93,6 @@ use common\models\Social; public function actionVacancy() { - - $searchModel = new SearchVacancyForm(); $specialization = Specialization::specializationsList(); diff --git a/frontend/messages/ru/app.php b/frontend/messages/ru/app.php index 16f70e0..3a6a20c 100644 --- a/frontend/messages/ru/app.php +++ b/frontend/messages/ru/app.php @@ -169,5 +169,5 @@ 'Project list' => 'Список заказов', 'Add project' => 'Добавить заказ', 'Main project' => 'Основной заказ', - + 'Not found' => 'Ничего не найдено', ]; \ No newline at end of file diff --git a/frontend/models/SearchVacancyForm.php b/frontend/models/SearchVacancyForm.php index 28bd764..de074d3 100644 --- a/frontend/models/SearchVacancyForm.php +++ b/frontend/models/SearchVacancyForm.php @@ -18,8 +18,6 @@ class SearchVacancyForm extends Model public $city; public $specialization; - - /** * @inheritdoc */ @@ -56,12 +54,8 @@ class SearchVacancyForm extends Model $query = Vacancy::find() ->distinct(true) - ->joinWith(['specializations']); - - - - - + ->joinWith(['specializations', 'user']) + ->andWhere(['user.type' => 2]); if (!$this->validate()) { @@ -76,10 +70,6 @@ class SearchVacancyForm extends Model 'specialization.specialization_id' => $this->specialization, ]); - - - - return $query; } } diff --git a/frontend/views/chat/message.php b/frontend/views/chat/message.php index 984198d..0f52439 100755 --- a/frontend/views/chat/message.php +++ b/frontend/views/chat/message.php @@ -1,6 +1,7 @@
interlocutor->userInfo->name ?>
-
- - -
+ 'rating_messange', + 'value' => $chat->interlocutor->userInfo->rating, + 'pluginOptions' => ['displayOnly' => true, 'size' => 'xxs'] + ]); + ?>
interlocutor->comments) ?> отзывов
diff --git a/frontend/views/company/_company_common_review.php b/frontend/views/company/_company_common_review.php index 96b63d3..4cabfda 100644 --- a/frontend/views/company/_company_common_review.php +++ b/frontend/views/company/_company_common_review.php @@ -3,18 +3,16 @@ * @var Comment $model */ use common\modules\comment\models\Comment; + use kartik\rating\StarRating; ?> rating )) { - ?> -
- - - - -
- 'rating_company_review', + 'value' => $model->rating->value, + 'pluginOptions' => ['displayOnly' => true, 'size' => 'xxs'] + ]); } ?>
diff --git a/frontend/views/company/_company_team_review.php b/frontend/views/company/_company_team_review.php index d714460..5e3a341 100644 --- a/frontend/views/company/_company_team_review.php +++ b/frontend/views/company/_company_team_review.php @@ -6,26 +6,24 @@ * @var ListView $widget */ use common\modules\comment\models\Comment; + use kartik\rating\StarRating; use yii\helpers\Html; use yii\widgets\ListView; ?> rating )) { - ?> -
- - - - -
- 'rating_company_team', + 'value' => $model->rating->value, + 'pluginOptions' => ['displayOnly' => true, 'size' => 'xxs'] + ]); } ?> user_id )) { ?> -
Отзыв от: author->name ?>
+
Отзыв от: author ?>
diff --git a/frontend/views/company/common.php b/frontend/views/company/common.php index e32ef2e..086ecee 100755 --- a/frontend/views/company/common.php +++ b/frontend/views/company/common.php @@ -18,7 +18,13 @@ ?>
О компании
- userInfo->about ?> + userInfo->about )) { + echo $company->userInfo->about; + } else { + echo Yii::t('app', 'Not found'); + } + ?>
-
-
-
- $blogProvider, - 'options' => [ - 'class' => 'min-post-wr', - ], - 'itemView' => '_company_common_blog', - 'itemOptions' => [ - 'class' => 'min-post-block', - ], - 'layout' => '{items}', - 'viewParams' => [ 'parent_view' => $this ], - ]); - ?> + if(!empty( $blogProvider->models )) { + ?> +
+
+
+ $blogProvider, + 'options' => [ + 'class' => 'min-post-wr', + ], + 'itemView' => '_company_common_blog', + 'itemOptions' => [ + 'class' => 'min-post-block', + ], + 'layout' => '{items}', + 'viewParams' => [ 'parent_view' => $this ], + ]); + ?> +
-
-endBlock(); $this->beginBlock('team'); /* * User preloaded $company->teams models */ $teams = ArrayHelper::index($company->teams, 'team_id', 'department.name'); // Group team members according to their department -?> -
-
-
-
Состав команды
-
-
- -
- - - - - -
- -
- - - - - - -
Ф.И.О.Опыт, лет
- - - - - - - - -
- - lastname . ' ' . $team->firstname ?> - experience_from )) { - echo date('Y') - $team->experience_from; - } else { - echo 'Не указан'; - } - ?> -
-
- -
-
- -
- - - - - -
- -
- - - - - - -
Ф.И.О.Опыт, лет
- - - - - - - - -
- - lastname . ' ' . $team->firstname ?> - experience_from )) { - echo date('Y') - $team->experience_from; - } else { - echo 'Не указан'; - } - ?> -
-
- + if(!empty( $teams )) { + ?> +
+
+
+
Состав команды
+
+
+ +
+ + + + + +
+ +
+ + + + + + +
Ф.И.О.Опыт, лет
+ + + + + + + + +
+ + lastname . ' ' . $team->firstname ?> + experience_from )) { + echo date('Y') - $team->experience_from; + } else { + echo 'Не указан'; + } + ?> +
+
+ +
+
+ +
+ + + + + +
+ +
+ + + + + + +
Ф.И.О.Опыт, лет
+ + + + + + + + +
+ + lastname . ' ' . $team->firstname ?> + experience_from )) { + echo date('Y') - $team->experience_from; + } else { + echo 'Не указан'; + } + ?> +
+
+ +
-
-endBlock(); $this->beginBlock('review'); -?> -
-
-
-
Отзывов: totalCount ?>
- $commentProvider, - 'options' => [ - 'class' => 'company-performer-comments-wr style', - ], - 'itemView' => '_company_common_review', - 'itemOptions' => [ - 'class' => 'company-performer-comments-bl', - ], - 'layout' => '{items}', - ]); - ?> -
- $company->id, - 'type' => (!empty($this->params['type']))?$this->params['type']:null, - ]) ?> + if(!empty( $commentProvider->models )) { + ?> +
+
+
+
Отзывов: totalCount ?>
+ $commentProvider, + 'options' => [ + 'class' => 'company-performer-comments-wr style', + ], + 'itemView' => '_company_common_review', + 'itemOptions' => [ + 'class' => 'company-performer-comments-bl', + ], + 'layout' => '{items}', + ]); + ?> +
+ $company->id, + 'type' => ( !empty( $this->params[ 'type' ] ) ) ? $this->params[ 'type' ] : NULL, + ]) ?> +
-
-endBlock(); /*====End blocks for layout====*/ ?> \ No newline at end of file diff --git a/frontend/views/company/gallery.php b/frontend/views/company/gallery.php index 4d056a8..13c6874 100755 --- a/frontend/views/company/gallery.php +++ b/frontend/views/company/gallery.php @@ -1,75 +1,76 @@ params['company'] = $company; -$this->title = 'My Yii Application'; + $this->params[ 'company' ] = $company; + $this->title = 'My Yii Application'; ?> + +
+ +
+
+
    + +
  • +
    + +
    - -
    - -
    -
    -
      - -
    • -
      - - -
    • - + + + -
    -
    -
    - - +
+
+
+ + +
- - -
\ No newline at end of file diff --git a/frontend/views/company/review.php b/frontend/views/company/review.php index f5a42be..3af6644 100755 --- a/frontend/views/company/review.php +++ b/frontend/views/company/review.php @@ -18,6 +18,7 @@ 'model_id' => $company->id, 'comment_class' => \common\modules\comment\models\Comment::className(), 'rating_class' => \common\modules\comment\models\Rating::className(), + 'template' => ($company->id == \Yii::$app->user->id)?"{success}\n{list}":"{success}\n{form}\n{list}", 'class_options' => [ 'scenario' => is_int(\Yii::$app->user->getId()) ? \common\modules\comment\models\Comment::SCENARIO_USER : \common\modules\comment\models\Comment::SCENARIO_GUEST, 'user_id' => \Yii::$app->user->getId(), diff --git a/frontend/views/layouts/company.php b/frontend/views/layouts/company.php index b3aa66e..da6a2dd 100755 --- a/frontend/views/layouts/company.php +++ b/frontend/views/layouts/company.php @@ -5,6 +5,7 @@ */ use common\models\User; + use kartik\rating\StarRating; use yii\helpers\Html; use yii\helpers\Url; use yii\web\View; @@ -193,12 +194,13 @@
-
- - - - -
+ 'rating_company', + 'value' => $this->params[ 'company' ]->userInfo->rating, + 'pluginOptions' => ['displayOnly' => true, 'size' => 'xxs'] + ]); + ?>
params[ 'company' ]->comments) ?> мнений
-
- - - - -
+ 'rating_company', + 'value' => $this->params[ 'company' ]->userInfo->rating, + 'pluginOptions' => ['displayOnly' => true, 'size' => 'xxs'] + ]); + ?>
params[ 'company' ]->comments) ?> мнений
beginContent('@app/views/layouts/main.php');
-
- - - - -
+ 'rating_company', + 'value' => $this->params[ 'user' ]->userInfo->rating, + 'pluginOptions' => ['displayOnly' => true, 'size' => 'xxs'] + ]); + ?>
params[ 'user' ]->comments) ?> мнений
-
- - - - -
+ 'rating_company', + 'value' => $this->params[ 'user' ]->userInfo->rating, + 'pluginOptions' => ['displayOnly' => true, 'size' => 'xxs'] + ]); + ?>
params[ 'user' ]->comments) ?> мнений
comments[ $i ]->rating )) { - ?> -
- - - - -
- 'rating_common', + 'value' => $user->comments[ $i ]->rating->value, + 'pluginOptions' => ['displayOnly' => true, 'size' => 'xxs'] + ]); } ?>
Мнение от: comments[ $i ]->getAuthor(' (Гость)') ?>
diff --git a/frontend/views/performer/review.php b/frontend/views/performer/review.php index 49a3539..d9abe9b 100755 --- a/frontend/views/performer/review.php +++ b/frontend/views/performer/review.php @@ -18,6 +18,7 @@ 'model_id' => $user->id, 'comment_class' => \common\modules\comment\models\Comment::className(), 'rating_class' => \common\modules\comment\models\Rating::className(), + 'template' => ($user->id == \Yii::$app->user->id)?"{success}\n{list}":"{success}\n{form}\n{list}", 'class_options' => [ 'scenario' => is_int(\Yii::$app->user->getId()) ? \common\modules\comment\models\Comment::SCENARIO_USER : \common\modules\comment\models\Comment::SCENARIO_GUEST, 'user_id' => \Yii::$app->user->getId(), diff --git a/frontend/views/performer/workplace.php b/frontend/views/performer/workplace.php index f44321c..38509f5 100755 --- a/frontend/views/performer/workplace.php +++ b/frontend/views/performer/workplace.php @@ -10,27 +10,33 @@ ?>
-

Опыт работы

-
- jobs as $job): ?> -
-
name ?>
- -
position ?>
+ jobs )) { + ?> +

Опыт работы

+
+ jobs as $job): ?> +
+
name ?>
+ +
position ?>
+
+
- - - -
+
\ No newline at end of file diff --git a/frontend/views/search/_customer_list_view.php b/frontend/views/search/_customer_list_view.php index 2f4f889..874e97a 100644 --- a/frontend/views/search/_customer_list_view.php +++ b/frontend/views/search/_customer_list_view.php @@ -8,30 +8,49 @@ use common\models\Bookmark; use common\models\Project; use common\models\User; - use frontend\helpers\TextHelper; + use kartik\rating\StarRating; use yii\bootstrap\Html; - use yii\helpers\Url; use yii\widgets\ListView; + ?>
type == 2) { - echo Html::a($model->companyInfo->name, ['company/common', 'company_id' => $model->id]); + echo Html::a($model->companyInfo->name, [ + 'company/common', + 'company_id' => $model->id, + ]); } else { - echo Html::a($model->firstname . $model->lastname, ['performer/common', 'performer_id' => $model->id]); + echo Html::a($model->firstname . $model->lastname, [ + 'performer/common', + 'performer_id' => $model->id, + ]); } ?>
-
- +
userInfo->rating) { - echo ""; - } else { - echo ""; - } + if($rating = $model->userInfo->rating) { + echo StarRating::widget([ + 'name' => 'rating_customer', + 'value' => $rating, + 'pluginOptions' => [ + 'displayOnly' => true, + 'size' => 'xxs', + ], + ]); + } else { + echo StarRating::widget([ + 'name' => 'rating_customer', + 'value' => 0, + 'pluginOptions' => [ + 'displayOnly' => true, + 'size' => 'xxs', + ], + ]); + } ?>
@@ -55,15 +74,18 @@
Последний визит: formatter->asTimestamp($model->userInfo->date_visit)) < 1800) { - echo 'Онлайн'; - } else { - echo \Yii::$app->formatter->asRelativeTime($model->userInfo->date_visit); - } + if(( time() - \Yii::$app->formatter->asTimestamp($model->userInfo->date_visit) ) < 1800) { + echo 'Онлайн'; + } else { + echo \Yii::$app->formatter->asRelativeTime($model->userInfo->date_visit); + } ?>
- projects), ['search/project', (new Project())->formName().'[user_id]' => $model->id]) ?> + projects), [ + 'search/project', + (new Project())->formName() . '[user_id]' => $model->id, + ]) ?>
@@ -71,7 +93,7 @@
userInfo->image?:"/images/search_performer_img-1.jpg", ['class' => 'search_customer_image']); + echo Html::img($model->userInfo->image ? : "/images/search_performer_img-1.jpg", [ 'class' => 'search_customer_image' ]); ?>
diff --git a/frontend/views/search/_performer_list_view.php b/frontend/views/search/_performer_list_view.php index 4c39282..3999d72 100644 --- a/frontend/views/search/_performer_list_view.php +++ b/frontend/views/search/_performer_list_view.php @@ -3,6 +3,7 @@ * @var User $model */ use common\models\User; + use kartik\rating\StarRating; use yii\bootstrap\Html; use yii\helpers\ArrayHelper; use yii\helpers\Url; @@ -15,13 +16,18 @@ ->limit(4) ->all(), 'cover'); ?> - - 'small-img-search gallery-box-min' ]) ?> - - minImg($portfolios[ $i ], '318', '228')), '#', [ 'class' => 'big-img-search gallery-box-min' ]) ?> - - + if(!empty($portfolios)) { + for($i = 0; $i < count($portfolios); $i++) { + if($i) { + echo Html::a(Html::img($portfolios[ $i ]), '#', [ 'class' => 'small-img-search gallery-box-min' ]); + } else { + echo Html::a(Html::img($model->minImg($portfolios[ $i ], '318', '228')), '#', [ 'class' => 'big-img-search gallery-box-min' ]); + } + } + } else { + echo 'Работы в порфолио отсутствуют'; + } + ?>