Commit 38ffb9dbb75fdc4e0f69f5f55154d71ceecb6b03
1 parent
dde061b3
test
Showing
16 changed files
with
401 additions
and
372 deletions
Show diff stats
common/behaviors/ShowImage.php
| @@ -42,12 +42,18 @@ | @@ -42,12 +42,18 @@ | ||
| 42 | if(!file_exists($filename)) { | 42 | if(!file_exists($filename)) { |
| 43 | 43 | ||
| 44 | $original = $storage . dirname($dir) . '/original.' . $type[ 1 ]; | 44 | $original = $storage . dirname($dir) . '/original.' . $type[ 1 ]; |
| 45 | + $resizer = new UploaderComponent(); | ||
| 45 | if(file_exists($original)) { | 46 | if(file_exists($original)) { |
| 46 | - $resizer = new UploaderComponent(); | ||
| 47 | $resizer->resizeImg($width, $height, $original, $filename); | 47 | $resizer->resizeImg($width, $height, $original, $filename); |
| 48 | - | ||
| 49 | } else { | 48 | } else { |
| 50 | - throw new \Exception("Файл $original не существует"); | 49 | + |
| 50 | + $imageNotFound = yii\helpers\Url::to('@storage')."/imageNotFound".$width."x".$height.".jpg"; | ||
| 51 | + if(!file_exists($imageNotFound)){ | ||
| 52 | + $resizer->resizeImg($width, $height, yii\helpers\Url::to('@storage')."/imageNotFound.jpg", $imageNotFound ); | ||
| 53 | + } | ||
| 54 | + return "/storage/imageNotFound".$width."x".$height.".jpg"; | ||
| 55 | + | ||
| 56 | + | ||
| 51 | } | 57 | } |
| 52 | 58 | ||
| 53 | } | 59 | } |
common/models/Portfolio.php
| @@ -32,6 +32,8 @@ | @@ -32,6 +32,8 @@ | ||
| 32 | * @property Comment[] $comment | 32 | * @property Comment[] $comment |
| 33 | * @property Rating[] $rating | 33 | * @property Rating[] $rating |
| 34 | * @property string $ratingValue | 34 | * @property string $ratingValue |
| 35 | + * @method string minImg( string $dir, $width, $height = NULL ) Resizes image | ||
| 36 | + * @method array ShowGallery( string $array ) Splits string to image paths array | ||
| 35 | */ | 37 | */ |
| 36 | class Portfolio extends \yii\db\ActiveRecord | 38 | class Portfolio extends \yii\db\ActiveRecord |
| 37 | { | 39 | { |
| @@ -195,6 +197,9 @@ | @@ -195,6 +197,9 @@ | ||
| 195 | return $this->hasOne(Gallery::className(), [ 'gallery_id' => 'gallery_id' ]); | 197 | return $this->hasOne(Gallery::className(), [ 'gallery_id' => 'gallery_id' ]); |
| 196 | } | 198 | } |
| 197 | 199 | ||
| 200 | + /** | ||
| 201 | + * @return ActiveQuery | ||
| 202 | + */ | ||
| 198 | public function getPortfolioUsers() | 203 | public function getPortfolioUsers() |
| 199 | { | 204 | { |
| 200 | return $this->hasMany(PortfolioUser::className(), [ 'portfolio_id' => 'portfolio_id' ]) | 205 | return $this->hasMany(PortfolioUser::className(), [ 'portfolio_id' => 'portfolio_id' ]) |
| @@ -212,7 +217,9 @@ | @@ -212,7 +217,9 @@ | ||
| 212 | public function getComments() | 217 | public function getComments() |
| 213 | { | 218 | { |
| 214 | return $this->hasMany(Comment::className(), [ 'model_id' => 'portfolio_id' ]) | 219 | return $this->hasMany(Comment::className(), [ 'model_id' => 'portfolio_id' ]) |
| 215 | - ->andWhere([ 'comment.model' => $this->className(), 'comment.status' => Comment::STATUS_ACTIVE ]); | 220 | + ->andWhere([ 'comment.model' => $this->className(), |
| 221 | + 'comment.status' => Comment::STATUS_ACTIVE, | ||
| 222 | + ]); | ||
| 216 | } | 223 | } |
| 217 | 224 | ||
| 218 | /** | 225 | /** |
common/models/User.php
| @@ -56,6 +56,8 @@ | @@ -56,6 +56,8 @@ | ||
| 56 | * @property int $ratingPG | 56 | * @property int $ratingPG |
| 57 | * @property string $lastVisit | 57 | * @property string $lastVisit |
| 58 | * @property string $link | 58 | * @property string $link |
| 59 | + * @method string minImg( string $dir, $width, $height = NULL ) Resizes image | ||
| 60 | + * @method array ShowGallery( string $array ) Splits string to image paths array | ||
| 59 | */ | 61 | */ |
| 60 | class User extends ActiveRecord implements IdentityInterface, UserRbacInterface | 62 | class User extends ActiveRecord implements IdentityInterface, UserRbacInterface |
| 61 | { | 63 | { |
| @@ -437,15 +439,15 @@ | @@ -437,15 +439,15 @@ | ||
| 437 | public function getAddress() | 439 | public function getAddress() |
| 438 | { | 440 | { |
| 439 | $address = $this->userInfo->city; | 441 | $address = $this->userInfo->city; |
| 440 | - if(!empty($this->userInfo->country)) { | ||
| 441 | - $address = $this->userInfo->country.', '.$address; | 442 | + if(!empty( $this->userInfo->country )) { |
| 443 | + $address = $this->userInfo->country . ', ' . $address; | ||
| 442 | } | 444 | } |
| 443 | if($this->type == 2) { | 445 | if($this->type == 2) { |
| 444 | - if(!empty($this->companyInfo->street)) { | ||
| 445 | - $address .= ', '.$this->companyInfo->street; | 446 | + if(!empty( $this->companyInfo->street )) { |
| 447 | + $address .= ', ' . $this->companyInfo->street; | ||
| 446 | } | 448 | } |
| 447 | - if(!empty($this->companyInfo->house)) { | ||
| 448 | - $address .= ', '.$this->companyInfo->house; | 449 | + if(!empty( $this->companyInfo->house )) { |
| 450 | + $address .= ', ' . $this->companyInfo->house; | ||
| 449 | } | 451 | } |
| 450 | } | 452 | } |
| 451 | return $address; | 453 | return $address; |
| @@ -535,7 +537,10 @@ | @@ -535,7 +537,10 @@ | ||
| 535 | public function getJobs() | 537 | public function getJobs() |
| 536 | { | 538 | { |
| 537 | return $this->hasMany(Job::className(), [ 'user_id' => 'id' ]) | 539 | return $this->hasMany(Job::className(), [ 'user_id' => 'id' ]) |
| 538 | - ->orderBy([ 'current' => SORT_DESC, 'date_start' => SORT_DESC]); | 540 | + ->orderBy([ |
| 541 | + 'current' => SORT_DESC, | ||
| 542 | + 'date_start' => SORT_DESC, | ||
| 543 | + ]); | ||
| 539 | } | 544 | } |
| 540 | 545 | ||
| 541 | /** | 546 | /** |
| @@ -613,8 +618,16 @@ | @@ -613,8 +618,16 @@ | ||
| 613 | */ | 618 | */ |
| 614 | public function getGalleries() | 619 | public function getGalleries() |
| 615 | { | 620 | { |
| 616 | - $portfolio_galleries = PortfolioGallery::find()->select('gallery_id')->asArray()->where(['user_id' => $this->id])->column(); | ||
| 617 | - return $this->hasMany(Gallery::className(), [ 'user_id' => 'id' ])->andWhere(['not', ['gallery_id' => $portfolio_galleries]]); | 621 | + $portfolio_galleries = PortfolioGallery::find() |
| 622 | + ->select('gallery_id') | ||
| 623 | + ->asArray() | ||
| 624 | + ->where([ 'user_id' => $this->id ]) | ||
| 625 | + ->column(); | ||
| 626 | + return $this->hasMany(Gallery::className(), [ 'user_id' => 'id' ]) | ||
| 627 | + ->andWhere([ | ||
| 628 | + 'not', | ||
| 629 | + [ 'gallery_id' => $portfolio_galleries ], | ||
| 630 | + ]); | ||
| 618 | } | 631 | } |
| 619 | 632 | ||
| 620 | /** | 633 | /** |
| @@ -654,7 +667,8 @@ | @@ -654,7 +667,8 @@ | ||
| 654 | ]) | 667 | ]) |
| 655 | ->andWhere([ | 668 | ->andWhere([ |
| 656 | 'comment.model' => $this->className(), | 669 | 'comment.model' => $this->className(), |
| 657 | - ])->orderBy(['date_update' => SORT_DESC]); | 670 | + ]) |
| 671 | + ->orderBy([ 'date_update' => SORT_DESC ]); | ||
| 658 | } | 672 | } |
| 659 | 673 | ||
| 660 | /** | 674 | /** |
| @@ -844,7 +858,7 @@ | @@ -844,7 +858,7 @@ | ||
| 844 | 858 | ||
| 845 | public function getIsOnline() | 859 | public function getIsOnline() |
| 846 | { | 860 | { |
| 847 | - if((time() - \Yii::$app->formatter->asTimestamp($this->userInfo->date_visit)) < 1800) { | 861 | + if(( time() - \Yii::$app->formatter->asTimestamp($this->userInfo->date_visit) ) < 1800) { |
| 848 | return true; | 862 | return true; |
| 849 | } else { | 863 | } else { |
| 850 | return false; | 864 | return false; |
common/modules/file/widgets/views/image_sizer.php
| @@ -164,7 +164,7 @@ | @@ -164,7 +164,7 @@ | ||
| 164 | var img = data.result.view; | 164 | var img = data.result.view; |
| 165 | var block = $("#<?= $field?>_img_block"); | 165 | var block = $("#<?= $field?>_img_block"); |
| 166 | block.append(img); | 166 | block.append(img); |
| 167 | - var gallery = $("#<?= $field?>_picture_link"); | 167 | + var gallery = $("#<?=$field_name?>"); |
| 168 | gallery.val(gallery.val() + data.result.link + ','); | 168 | gallery.val(gallery.val() + data.result.link + ','); |
| 169 | } | 169 | } |
| 170 | } | 170 | } |
| @@ -174,7 +174,7 @@ | @@ -174,7 +174,7 @@ | ||
| 174 | { | 174 | { |
| 175 | var url = $(this).data('url'); | 175 | var url = $(this).data('url'); |
| 176 | $(this).parent('.gallery_image').remove(); | 176 | $(this).parent('.gallery_image').remove(); |
| 177 | - var gallery = $("#<?= $field?>_picture_link"); | 177 | + var gallery = $("#<?=$field_name?>"); |
| 178 | var urls = gallery.val(); | 178 | var urls = gallery.val(); |
| 179 | gallery.val(urls.replace(url + ',', "")); | 179 | gallery.val(urls.replace(url + ',', "")); |
| 180 | $.post( | 180 | $.post( |
frontend/assets/AdminAsset.php
| @@ -21,12 +21,10 @@ class AdminAsset extends AssetBundle | @@ -21,12 +21,10 @@ class AdminAsset extends AssetBundle | ||
| 21 | 'css/style.css', | 21 | 'css/style.css', |
| 22 | 'css/art_box.css', | 22 | 'css/art_box.css', |
| 23 | '/admin/css/flags32.css', | 23 | '/admin/css/flags32.css', |
| 24 | - //'https://fonts.googleapis.com/css?family=Roboto:400,700&subset=cyrillic,latin', | ||
| 25 | ]; | 24 | ]; |
| 26 | public $js = [ | 25 | public $js = [ |
| 27 | 'js/script.js', | 26 | 'js/script.js', |
| 28 | '/admin/js/option.js', | 27 | '/admin/js/option.js', |
| 29 | - //'http://maps.google.com/maps/api/js?sensor=false', | ||
| 30 | 'js/markerclusterer.js', | 28 | 'js/markerclusterer.js', |
| 31 | 'js/jquery.scrollbox.min.js', | 29 | 'js/jquery.scrollbox.min.js', |
| 32 | 'js/slider.js', | 30 | 'js/slider.js', |
frontend/assets/AppAsset.php
| @@ -30,7 +30,7 @@ | @@ -30,7 +30,7 @@ | ||
| 30 | public $js = [ | 30 | public $js = [ |
| 31 | '/js/jscroll.js', | 31 | '/js/jscroll.js', |
| 32 | '/js/script.js', | 32 | '/js/script.js', |
| 33 | - //'http://maps.google.com/maps/api/js?sensor=false', | 33 | + 'http://maps.google.com/maps/api/js?sensor=false', |
| 34 | '/js/markerclusterer.js', | 34 | '/js/markerclusterer.js', |
| 35 | '/js/jquery.scrollbox.min.js', | 35 | '/js/jquery.scrollbox.min.js', |
| 36 | '/js/slider.js', | 36 | '/js/slider.js', |
frontend/config/main.php
| @@ -79,6 +79,7 @@ return [ | @@ -79,6 +79,7 @@ return [ | ||
| 79 | 'performer/portfolio/<performer_id:[\w-]+>/<type:(?:implementer|customer)>/<filter:[\d]+>' => 'performer/portfolio-filter', | 79 | 'performer/portfolio/<performer_id:[\w-]+>/<type:(?:implementer|customer)>/<filter:[\d]+>' => 'performer/portfolio-filter', |
| 80 | 'performer/portfolio/<performer_id:[\w-]+>/<filter:[\d]+>' => 'performer/portfolio-filter', | 80 | 'performer/portfolio/<performer_id:[\w-]+>/<filter:[\d]+>' => 'performer/portfolio-filter', |
| 81 | 'performer/portfolio-view/<performer_id:[\w-]+>/<type:(?:implementer|customer)>/<portfolio_id:[\w-]+>' => 'performer/portfolio-view', | 81 | 'performer/portfolio-view/<performer_id:[\w-]+>/<type:(?:implementer|customer)>/<portfolio_id:[\w-]+>' => 'performer/portfolio-view', |
| 82 | + 'performer/portfolio-view/<performer_id:[\w-]+>/<portfolio_id:[\w-]+>/<portfolio_user:[\w-]+>' => 'performer/portfolio-view', | ||
| 82 | 'performer/portfolio-view/<performer_id:[\w-]+>/<portfolio_id:[\w-]+>' => 'performer/portfolio-view', | 83 | 'performer/portfolio-view/<performer_id:[\w-]+>/<portfolio_id:[\w-]+>' => 'performer/portfolio-view', |
| 83 | 'performer/blog-view/<performer_id:[\w-]+>/<type:(?:implementer|customer)>/<link:[\w-]+>' => 'performer/blog-view', | 84 | 'performer/blog-view/<performer_id:[\w-]+>/<type:(?:implementer|customer)>/<link:[\w-]+>' => 'performer/blog-view', |
| 84 | 'performer/blog-view/<performer_id:[\w-]+>/<link:[\w-]+>' => 'performer/blog-view', | 85 | 'performer/blog-view/<performer_id:[\w-]+>/<link:[\w-]+>' => 'performer/blog-view', |
| @@ -86,7 +87,8 @@ return [ | @@ -86,7 +87,8 @@ return [ | ||
| 86 | 'performer/<action>/<performer_id:[\w-]+>' => 'performer/<action>', | 87 | 'performer/<action>/<performer_id:[\w-]+>' => 'performer/<action>', |
| 87 | 'company/portfolio/<company_id:[\w-]+>/<type:(?:implementer|customer)>/<filter:[\d]+>' => 'company/portfolio-filter', | 88 | 'company/portfolio/<company_id:[\w-]+>/<type:(?:implementer|customer)>/<filter:[\d]+>' => 'company/portfolio-filter', |
| 88 | 'company/portfolio/<company_id:[\w-]+>/<filter:[\d]+>' => 'company/portfolio-filter', | 89 | 'company/portfolio/<company_id:[\w-]+>/<filter:[\d]+>' => 'company/portfolio-filter', |
| 89 | - 'company/portfolio-view/<company_id:[\w-]+>/<type:(?:implementer|customer)>/<portfolio_id:[\w-]+>' => 'company/portfolio-view', | 90 | + 'company/portfolio-view/<company_id:[\w-]+>/<portfolio_id:[\w-]+>/<portfolio_user:[\w-]+>/<type:(?:implementer|customer)>' => 'company/portfolio-view', |
| 91 | + 'company/portfolio-view/<company_id:[\w-]+>/<portfolio_id:[\w-]+>/<portfolio_user:[\w-]+>' => 'company/portfolio-view', | ||
| 90 | 'company/portfolio-view/<company_id:[\w-]+>/<portfolio_id:[\w-]+>' => 'company/portfolio-view', | 92 | 'company/portfolio-view/<company_id:[\w-]+>/<portfolio_id:[\w-]+>' => 'company/portfolio-view', |
| 91 | 'company/blog-view/<company_id:[\w-]+>/<type:(?:implementer|customer)>/<link:[\w-]+>' => 'company/blog-view', | 93 | 'company/blog-view/<company_id:[\w-]+>/<type:(?:implementer|customer)>/<link:[\w-]+>' => 'company/blog-view', |
| 92 | 'company/blog-view/<company_id:[\w-]+>/<link:[\w-]+>' => 'company/blog-view', | 94 | 'company/blog-view/<company_id:[\w-]+>/<link:[\w-]+>' => 'company/blog-view', |
frontend/controllers/CompanyController.php
| @@ -6,6 +6,8 @@ | @@ -6,6 +6,8 @@ | ||
| 6 | use common\models\Gallery; | 6 | use common\models\Gallery; |
| 7 | use common\models\Portfolio; | 7 | use common\models\Portfolio; |
| 8 | use common\models\PortfolioSpecialization; | 8 | use common\models\PortfolioSpecialization; |
| 9 | + use common\models\PortfolioUser; | ||
| 10 | + use common\models\Specialization; | ||
| 9 | use common\models\Team; | 11 | use common\models\Team; |
| 10 | use common\models\Vacancy; | 12 | use common\models\Vacancy; |
| 11 | use common\models\VacancySpecialization; | 13 | use common\models\VacancySpecialization; |
| @@ -139,68 +141,95 @@ | @@ -139,68 +141,95 @@ | ||
| 139 | 141 | ||
| 140 | public function actionPortfolio($company_id, $type = 'implementer') | 142 | public function actionPortfolio($company_id, $type = 'implementer') |
| 141 | { | 143 | { |
| 142 | - $company = User::findOne($company_id); | 144 | + $company = User::find() |
| 145 | + ->where([ | ||
| 146 | + 'id' => $company_id, | ||
| 147 | + ]) | ||
| 148 | + ->joinWith([ | ||
| 149 | + 'portfolios' => function($query) { | ||
| 150 | + $query->indexBy('portfolio_id'); | ||
| 151 | + }, | ||
| 152 | + 'portfolios.specializations', | ||
| 153 | + ]) | ||
| 154 | + ->one(); | ||
| 143 | 155 | ||
| 144 | if(!$company instanceof User) { | 156 | if(!$company instanceof User) { |
| 145 | throw new BadRequestHttpException('Пользователь не найден'); | 157 | throw new BadRequestHttpException('Пользователь не найден'); |
| 146 | } | 158 | } |
| 147 | - $projects = ArrayHelper::getColumn($company->portfolios, 'portfolio_id'); | ||
| 148 | - | ||
| 149 | - $filters = PortfolioSpecialization::find() | ||
| 150 | - ->select([ | ||
| 151 | - "specialization_id", | ||
| 152 | - "COUNT('specialization_id') AS count", | ||
| 153 | - ]) | ||
| 154 | - ->where([ "portfolio_id" => $projects ]) | ||
| 155 | - ->groupBy("specialization_id") | ||
| 156 | - ->all(); | ||
| 157 | - | ||
| 158 | - $portfolio = new ArrayDataProvider([ | ||
| 159 | - 'allModels' => $company->getPortfolios() | ||
| 160 | - ->orderBy('portfolio_id') | ||
| 161 | - ->all(), | 159 | + |
| 160 | + $filters = Specialization::find() | ||
| 161 | + ->select([ | ||
| 162 | + 'count' => 'COUNT(portfolio_specialization.specialization_id)', | ||
| 163 | + 'portfolio_specialization.specialization_id', | ||
| 164 | + 'specialization.specialization_name', | ||
| 165 | + ]) | ||
| 166 | + ->join('INNER JOIN', 'portfolio_specialization', 'specialization.specialization_id = portfolio_specialization.specialization_id') | ||
| 167 | + ->where([ 'portfolio_specialization.portfolio_id' => array_keys($company->portfolios) ]) | ||
| 168 | + ->groupBy([ | ||
| 169 | + 'portfolio_specialization.specialization_id', | ||
| 170 | + 'specialization.specialization_name', | ||
| 171 | + ]) | ||
| 172 | + ->indexBy('specialization_id') | ||
| 173 | + ->asArray() | ||
| 174 | + ->all(); | ||
| 175 | + | ||
| 176 | + $portfolio = new ActiveDataProvider([ | ||
| 177 | + 'query' => $company->getPortfolios(), | ||
| 162 | 'pagination' => [ | 178 | 'pagination' => [ |
| 163 | 'pageSize' => 9, | 179 | 'pageSize' => 9, |
| 164 | ], | 180 | ], |
| 181 | + 'sort' => new Sort([ | ||
| 182 | + 'defaultOrder' => [ | ||
| 183 | + 'portfolio_id' => SORT_DESC, | ||
| 184 | + ], | ||
| 185 | + ]), | ||
| 165 | ]); | 186 | ]); |
| 166 | 187 | ||
| 167 | return $this->render('portfolio', [ | 188 | return $this->render('portfolio', [ |
| 168 | 'company' => $company, | 189 | 'company' => $company, |
| 169 | 'filters' => $filters, | 190 | 'filters' => $filters, |
| 170 | 'portfolio' => $portfolio, | 191 | 'portfolio' => $portfolio, |
| 171 | - 'count' => count($company->portfolios), | ||
| 172 | ]); | 192 | ]); |
| 173 | } | 193 | } |
| 174 | 194 | ||
| 175 | public function actionPortfolioFilter($company_id, $filter, $type = 'implementer') | 195 | public function actionPortfolioFilter($company_id, $filter, $type = 'implementer') |
| 176 | { | 196 | { |
| 177 | - $company = User::findOne($company_id); | 197 | + $company = User::find() |
| 198 | + ->where([ | ||
| 199 | + 'id' => $company_id, | ||
| 200 | + ]) | ||
| 201 | + ->joinWith([ | ||
| 202 | + 'portfolios' => function($query) { | ||
| 203 | + $query->indexBy('portfolio_id'); | ||
| 204 | + }, | ||
| 205 | + 'portfolios.specializations', | ||
| 206 | + ]) | ||
| 207 | + ->one(); | ||
| 178 | 208 | ||
| 179 | if(!$company instanceof User) { | 209 | if(!$company instanceof User) { |
| 180 | throw new BadRequestHttpException('Пользователь не найден'); | 210 | throw new BadRequestHttpException('Пользователь не найден'); |
| 181 | } | 211 | } |
| 182 | - $portfolios = ArrayHelper::getColumn($company->portfolios, 'portfolio_id'); | ||
| 183 | - | ||
| 184 | - $filters = PortfolioSpecialization::find() | ||
| 185 | - ->select([ | ||
| 186 | - "specialization_id", | ||
| 187 | - "COUNT('specialization_id') AS count", | ||
| 188 | - ]) | ||
| 189 | - ->where([ "portfolio_id" => $portfolios ]) | ||
| 190 | - ->groupBy("specialization_id") | ||
| 191 | - ->all(); | ||
| 192 | - | ||
| 193 | - $filter_result = PortfolioSpecialization::find() | ||
| 194 | - ->where([ | ||
| 195 | - 'specialization_id' => $filter, | ||
| 196 | - 'portfolio_id' => $portfolios, | ||
| 197 | - ]) | ||
| 198 | - ->all(); | ||
| 199 | - | ||
| 200 | - $portfolio = new ArrayDataProvider([ | ||
| 201 | - 'allModels' => Portfolio::find() | ||
| 202 | - ->where([ 'portfolio_id' => ArrayHelper::getColumn($filter_result, 'portfolio_id') ]) | ||
| 203 | - ->all(), | 212 | + |
| 213 | + $filters = Specialization::find() | ||
| 214 | + ->select([ | ||
| 215 | + 'count' => 'COUNT(portfolio_specialization.specialization_id)', | ||
| 216 | + 'portfolio_specialization.specialization_id', | ||
| 217 | + 'specialization.specialization_name', | ||
| 218 | + ]) | ||
| 219 | + ->join('INNER JOIN', 'portfolio_specialization', 'specialization.specialization_id = portfolio_specialization.specialization_id') | ||
| 220 | + ->where([ 'portfolio_specialization.portfolio_id' => array_keys($company->portfolios) ]) | ||
| 221 | + ->groupBy([ | ||
| 222 | + 'portfolio_specialization.specialization_id', | ||
| 223 | + 'specialization.specialization_name', | ||
| 224 | + ]) | ||
| 225 | + ->indexBy('specialization_id') | ||
| 226 | + ->asArray() | ||
| 227 | + ->all(); | ||
| 228 | + | ||
| 229 | + $portfolio = new ActiveDataProvider([ | ||
| 230 | + 'query' => $company->getPortfolios() | ||
| 231 | + ->joinWith('specializations') | ||
| 232 | + ->where([ 'portfolio_specialization.specialization_id' => $filter ]), | ||
| 204 | 'pagination' => [ | 233 | 'pagination' => [ |
| 205 | 'pageSize' => 9, | 234 | 'pageSize' => 9, |
| 206 | ], | 235 | ], |
| @@ -211,20 +240,30 @@ | @@ -211,20 +240,30 @@ | ||
| 211 | 'filters' => $filters, | 240 | 'filters' => $filters, |
| 212 | 'portfolio' => $portfolio, | 241 | 'portfolio' => $portfolio, |
| 213 | 'filter_id' => $filter, | 242 | 'filter_id' => $filter, |
| 214 | - 'count' => count($company->portfolios), | ||
| 215 | ]); | 243 | ]); |
| 216 | } | 244 | } |
| 217 | 245 | ||
| 218 | - public function actionPortfolioView($company_id, $portfolio_id, $type = 'implementer') | 246 | + public function actionPortfolioView($company_id, $portfolio_id, $portfolio_user = NULL, $type = 'implementer') |
| 219 | { | 247 | { |
| 220 | $user = User::findOne($company_id); | 248 | $user = User::findOne($company_id); |
| 221 | $portfolio = $user->getPortfolios() | 249 | $portfolio = $user->getPortfolios() |
| 222 | ->where([ 'portfolio_id' => $portfolio_id ]) | 250 | ->where([ 'portfolio_id' => $portfolio_id ]) |
| 251 | + ->with('portfolioUsers') | ||
| 252 | + ->with('portfolioUsers.gallery') | ||
| 223 | ->one(); | 253 | ->one(); |
| 224 | - $portfolio->updateCounters([ 'view_count' => 1 ]); | 254 | + if(!empty( $portfolio_user )) { |
| 255 | + $portfolio_user = PortfolioUser::find() | ||
| 256 | + ->where([ 'portfolio_user_id' => $portfolio_user ]) | ||
| 257 | + ->with('gallery') | ||
| 258 | + ->with('user') | ||
| 259 | + ->one(); | ||
| 260 | + } else { | ||
| 261 | + $portfolio->updateCounters([ 'view_count' => 1 ]); | ||
| 262 | + } | ||
| 225 | return $this->render('portfolio-view', [ | 263 | return $this->render('portfolio-view', [ |
| 226 | - 'user' => $user, | ||
| 227 | - 'portfolio' => $portfolio, | 264 | + 'user' => $user, |
| 265 | + 'portfolio' => $portfolio, | ||
| 266 | + 'portfolio_user' => $portfolio_user, | ||
| 228 | ]); | 267 | ]); |
| 229 | } | 268 | } |
| 230 | 269 | ||
| @@ -407,9 +446,9 @@ | @@ -407,9 +446,9 @@ | ||
| 407 | $this->layout = 'gallery-company'; | 446 | $this->layout = 'gallery-company'; |
| 408 | 447 | ||
| 409 | return $this->render('gallery', [ | 448 | return $this->render('gallery', [ |
| 410 | - 'company' => $company, | ||
| 411 | - 'gallery' => $gallery, | ||
| 412 | - 'videos' => $videos, | 449 | + 'company' => $company, |
| 450 | + 'gallery' => $gallery, | ||
| 451 | + 'videos' => $videos, | ||
| 413 | ]); | 452 | ]); |
| 414 | } | 453 | } |
| 415 | 454 |
frontend/controllers/PerformerController.php
| @@ -6,6 +6,7 @@ | @@ -6,6 +6,7 @@ | ||
| 6 | use common\models\Gallery; | 6 | use common\models\Gallery; |
| 7 | use common\models\Portfolio; | 7 | use common\models\Portfolio; |
| 8 | use common\models\PortfolioSpecialization; | 8 | use common\models\PortfolioSpecialization; |
| 9 | + use common\models\PortfolioUser; | ||
| 9 | use Yii; | 10 | use Yii; |
| 10 | use yii\data\ActiveDataProvider; | 11 | use yii\data\ActiveDataProvider; |
| 11 | use yii\data\ArrayDataProvider; | 12 | use yii\data\ArrayDataProvider; |
| @@ -176,16 +177,27 @@ | @@ -176,16 +177,27 @@ | ||
| 176 | ]); | 177 | ]); |
| 177 | } | 178 | } |
| 178 | 179 | ||
| 179 | - public function actionPortfolioView($performer_id, $portfolio_id, $type = 'implementer') | 180 | + public function actionPortfolioView($performer_id, $portfolio_id, $portfolio_user = NULL, $type = 'implementer') |
| 180 | { | 181 | { |
| 181 | $user = User::findOne($performer_id); | 182 | $user = User::findOne($performer_id); |
| 182 | $portfolio = $user->getPortfolios() | 183 | $portfolio = $user->getPortfolios() |
| 183 | ->where([ 'portfolio_id' => $portfolio_id ]) | 184 | ->where([ 'portfolio_id' => $portfolio_id ]) |
| 185 | + ->with('portfolioUsers') | ||
| 186 | + ->with('portfolioUsers.gallery') | ||
| 184 | ->one(); | 187 | ->one(); |
| 185 | - $portfolio->updateCounters([ 'view_count' => 1 ]); | 188 | + if(!empty( $portfolio_user )) { |
| 189 | + $portfolio_user = PortfolioUser::find() | ||
| 190 | + ->where([ 'portfolio_user_id' => $portfolio_user ]) | ||
| 191 | + ->with('gallery') | ||
| 192 | + ->with('user') | ||
| 193 | + ->one(); | ||
| 194 | + } else { | ||
| 195 | + $portfolio->updateCounters([ 'view_count' => 1 ]); | ||
| 196 | + } | ||
| 186 | return $this->render('portfolio-view', [ | 197 | return $this->render('portfolio-view', [ |
| 187 | - 'user' => $user, | ||
| 188 | - 'portfolio' => $portfolio, | 198 | + 'user' => $user, |
| 199 | + 'portfolio' => $portfolio, | ||
| 200 | + 'portfolio_user' => $portfolio_user, | ||
| 189 | ]); | 201 | ]); |
| 190 | } | 202 | } |
| 191 | 203 | ||
| @@ -219,21 +231,21 @@ | @@ -219,21 +231,21 @@ | ||
| 219 | } | 231 | } |
| 220 | 232 | ||
| 221 | $blog = new ActiveDataProvider([ | 233 | $blog = new ActiveDataProvider([ |
| 222 | - 'query' => $user->getBlog(), | 234 | + 'query' => $user->getBlog(), |
| 223 | 'pagination' => new Pagination([ | 235 | 'pagination' => new Pagination([ |
| 224 | 'pageSize' => 1, | 236 | 'pageSize' => 1, |
| 225 | ]), | 237 | ]), |
| 226 | - 'sort' => new Sort([ | 238 | + 'sort' => new Sort([ |
| 227 | 'defaultOrder' => [ | 239 | 'defaultOrder' => [ |
| 228 | 'date_add' => SORT_DESC, | 240 | 'date_add' => SORT_DESC, |
| 229 | - 'name' => SORT_ASC, | 241 | + 'name' => SORT_ASC, |
| 230 | ], | 242 | ], |
| 231 | ]), | 243 | ]), |
| 232 | ]); | 244 | ]); |
| 233 | 245 | ||
| 234 | return $this->render('blog-list', [ | 246 | return $this->render('blog-list', [ |
| 235 | - 'user' => $user, | ||
| 236 | - 'blog' => $blog, | 247 | + 'user' => $user, |
| 248 | + 'blog' => $blog, | ||
| 237 | ]); | 249 | ]); |
| 238 | } | 250 | } |
| 239 | 251 | ||
| @@ -297,7 +309,7 @@ | @@ -297,7 +309,7 @@ | ||
| 297 | } | 309 | } |
| 298 | 310 | ||
| 299 | $gallery = new ActiveDataProvider([ | 311 | $gallery = new ActiveDataProvider([ |
| 300 | - 'query' =>$user->getGalleries(), | 312 | + 'query' => $user->getGalleries(), |
| 301 | 'pagination' => [ | 313 | 'pagination' => [ |
| 302 | 'pageSize' => 5, | 314 | 'pageSize' => 5, |
| 303 | ], | 315 | ], |
| @@ -308,9 +320,9 @@ | @@ -308,9 +320,9 @@ | ||
| 308 | $this->layout = 'gallery'; | 320 | $this->layout = 'gallery'; |
| 309 | 321 | ||
| 310 | return $this->render('gallery', [ | 322 | return $this->render('gallery', [ |
| 311 | - 'user' => $user, | ||
| 312 | - 'gallery' => $gallery, | ||
| 313 | - 'videos' => $videos, | 323 | + 'user' => $user, |
| 324 | + 'gallery' => $gallery, | ||
| 325 | + 'videos' => $videos, | ||
| 314 | ]); | 326 | ]); |
| 315 | } | 327 | } |
| 316 | 328 | ||
| @@ -319,13 +331,13 @@ | @@ -319,13 +331,13 @@ | ||
| 319 | if(!empty( \Yii::$app->request->get('type') )) { | 331 | if(!empty( \Yii::$app->request->get('type') )) { |
| 320 | $action->controller->view->params[ 'type' ] = \Yii::$app->request->get('type'); | 332 | $action->controller->view->params[ 'type' ] = \Yii::$app->request->get('type'); |
| 321 | } | 333 | } |
| 322 | - if(!empty(\Yii::$app->request->get('performer_id'))) { | 334 | + if(!empty( \Yii::$app->request->get('performer_id') )) { |
| 323 | $user = User::findOne(\Yii::$app->request->get('performer_id')); | 335 | $user = User::findOne(\Yii::$app->request->get('performer_id')); |
| 324 | - if(!empty($user) && $user->type == 2) { | 336 | + if(!empty( $user ) && $user->type == 2) { |
| 325 | $queryParams = \Yii::$app->request->queryParams; | 337 | $queryParams = \Yii::$app->request->queryParams; |
| 326 | - unset($queryParams['performer_id']); | ||
| 327 | - $queryParams['company_id'] = $user->id; | ||
| 328 | - return $this->redirect(array_merge(['company/'.$action->id], $queryParams)); | 338 | + unset( $queryParams[ 'performer_id' ] ); |
| 339 | + $queryParams[ 'company_id' ] = $user->id; | ||
| 340 | + return $this->redirect(array_merge([ 'company/' . $action->id ], $queryParams)); | ||
| 329 | } | 341 | } |
| 330 | } | 342 | } |
| 331 | return parent::beforeAction($action); | 343 | return parent::beforeAction($action); |
frontend/messages/ru/app.php
| @@ -179,4 +179,5 @@ | @@ -179,4 +179,5 @@ | ||
| 179 | 'Feedback answer' => 'Вопрос', | 179 | 'Feedback answer' => 'Вопрос', |
| 180 | 'Feedback file' => 'Файл', | 180 | 'Feedback file' => 'Файл', |
| 181 | 'Feedback date add' => 'Дата обращения', | 181 | 'Feedback date add' => 'Дата обращения', |
| 182 | + 'Projects' => 'Проекты', | ||
| 182 | ]; | 183 | ]; |
| 183 | \ No newline at end of file | 184 | \ No newline at end of file |
frontend/views/company/_portfolio_list_view.php
| @@ -4,7 +4,6 @@ | @@ -4,7 +4,6 @@ | ||
| 4 | */ | 4 | */ |
| 5 | use yii\helpers\ArrayHelper; | 5 | use yii\helpers\ArrayHelper; |
| 6 | use yii\helpers\Html; | 6 | use yii\helpers\Html; |
| 7 | - use yii\helpers\StringHelper; | ||
| 8 | use yii\helpers\Url; | 7 | use yii\helpers\Url; |
| 9 | use yii\web\View; | 8 | use yii\web\View; |
| 10 | 9 | ||
| @@ -36,21 +35,21 @@ | @@ -36,21 +35,21 @@ | ||
| 36 | <div class="portfolio-project-views-img"> | 35 | <div class="portfolio-project-views-img"> |
| 37 | <img src="/images/portfolio-project/ico-1.png"/></div> | 36 | <img src="/images/portfolio-project/ico-1.png"/></div> |
| 38 | </div> | 37 | </div> |
| 39 | - <div class="portfolio-project-views-txt">127</div> | 38 | + <div class="portfolio-project-views-txt"><?=$model->view_count?></div> |
| 40 | </div> | 39 | </div> |
| 41 | <div class="portfolio-project-rati ico-views-bl"> | 40 | <div class="portfolio-project-rati ico-views-bl"> |
| 42 | <div class="portfolio-project-views-img-wr"> | 41 | <div class="portfolio-project-views-img-wr"> |
| 43 | <div class="portfolio-project-views-img"> | 42 | <div class="portfolio-project-views-img"> |
| 44 | <img src="/images/portfolio-project/ico-2.png"/></div> | 43 | <img src="/images/portfolio-project/ico-2.png"/></div> |
| 45 | </div> | 44 | </div> |
| 46 | - <div class="portfolio-project-views-txt">10.0</div> | 45 | + <div class="portfolio-project-views-txt"><?php if(!empty($model->ratingValue)) { echo $model->ratingValue; } else { echo 'Нет'; } ?></div> |
| 47 | </div> | 46 | </div> |
| 48 | <div class="ico-views-bl"> | 47 | <div class="ico-views-bl"> |
| 49 | <div class="portfolio-project-views-img-wr"> | 48 | <div class="portfolio-project-views-img-wr"> |
| 50 | <div class="portfolio-project-views-img"> | 49 | <div class="portfolio-project-views-img"> |
| 51 | <img src="/images/portfolio-project/ico-3.png"/></div> | 50 | <img src="/images/portfolio-project/ico-3.png"/></div> |
| 52 | </div> | 51 | </div> |
| 53 | - <div class="portfolio-project-views-txt">14</div> | 52 | + <div class="portfolio-project-views-txt"><?=count($model->comments)?></div> |
| 54 | </div> | 53 | </div> |
| 55 | </div> | 54 | </div> |
| 56 | <div title="<?= implode(', ', ArrayHelper::getColumn($model->specializations, 'specialization_name')) ?>" class="portfolio-project-blocks-tags"><?= implode(', ', ArrayHelper::getColumn($model->specializations, 'specialization_name')) ?></div> | 55 | <div title="<?= implode(', ', ArrayHelper::getColumn($model->specializations, 'specialization_name')) ?>" class="portfolio-project-blocks-tags"><?= implode(', ', ArrayHelper::getColumn($model->specializations, 'specialization_name')) ?></div> |
frontend/views/company/portfolio-view.php
| 1 | <?php | 1 | <?php |
| 2 | 2 | ||
| 3 | use common\models\Portfolio; | 3 | use common\models\Portfolio; |
| 4 | + use common\models\PortfolioUser; | ||
| 4 | use common\models\User; | 5 | use common\models\User; |
| 6 | + use kartik\rating\StarRating; | ||
| 7 | + use yii\helpers\ArrayHelper; | ||
| 5 | use yii\helpers\Html; | 8 | use yii\helpers\Html; |
| 9 | + use yii\helpers\Url; | ||
| 6 | use yii\web\ViewAction; | 10 | use yii\web\ViewAction; |
| 11 | + use yii\widgets\Pjax; | ||
| 7 | 12 | ||
| 8 | /** | 13 | /** |
| 9 | - * @var ViewAction $this | ||
| 10 | - * @var User $user | ||
| 11 | - * @var Portfolio $portfolio | 14 | + * @var ViewAction $this |
| 15 | + * @var User $user | ||
| 16 | + * @var Portfolio $portfolio | ||
| 17 | + * @var PortfolioUser $portfolio_user | ||
| 12 | */ | 18 | */ |
| 13 | $this->params[ 'company' ] = $user; | 19 | $this->params[ 'company' ] = $user; |
| 14 | 20 | ||
| 15 | $this->title = 'My Yii Application'; | 21 | $this->title = 'My Yii Application'; |
| 22 | + $rating = $portfolio->getRatingValue(); | ||
| 23 | + if(!empty( $portfolio_user )) { | ||
| 24 | + $portfolio_user_gallery = $portfolio->ShowGallery($portfolio_user->gallery->photo); | ||
| 25 | + } | ||
| 16 | ?> | 26 | ?> |
| 17 | <div class="portfolio-new-page-wrapper style"> | 27 | <div class="portfolio-new-page-wrapper style"> |
| 28 | + <?php | ||
| 29 | + Pjax::begin(); | ||
| 30 | + if(!empty( $portfolio_user )) { | ||
| 31 | + echo Html::a('Вернуться к основной запаси', [ | ||
| 32 | + 'company/portfolio-view', | ||
| 33 | + 'company_id' => $user->id, | ||
| 34 | + 'portfolio_id' => $portfolio->portfolio_id, | ||
| 35 | + ]); | ||
| 36 | + } | ||
| 37 | + ?> | ||
| 18 | <div class="new-portfolio-bg style "> | 38 | <div class="new-portfolio-bg style "> |
| 19 | - <?= Html::img($portfolio->minImg($portfolio->cover, '720', '280')) ?> | 39 | + <?php |
| 40 | + if(!empty( $portfolio_user )) { | ||
| 41 | + echo Html::img($portfolio->minImg(ArrayHelper::getValue($portfolio_user_gallery, 0, ''), '720', '280')); | ||
| 42 | + } else { | ||
| 43 | + echo Html::img($portfolio->minImg($portfolio->cover, '720', '280')); | ||
| 44 | + } | ||
| 45 | + ?> | ||
| 20 | </div> | 46 | </div> |
| 21 | <div class="new-portfolio-icons-rating-wr style"> | 47 | <div class="new-portfolio-icons-rating-wr style"> |
| 22 | <div class="new-portfolio-icons"> | 48 | <div class="new-portfolio-icons"> |
| @@ -33,41 +59,64 @@ | @@ -33,41 +59,64 @@ | ||
| 33 | <div class="portfolio-project-views-img"> | 59 | <div class="portfolio-project-views-img"> |
| 34 | <img src="/images/portfolio-project/ico-2.png"></div> | 60 | <img src="/images/portfolio-project/ico-2.png"></div> |
| 35 | </div> | 61 | </div> |
| 36 | - <div class="portfolio-project-views-txt">XX.X</div> | 62 | + <div class="portfolio-project-views-txt"><?= ( !empty( $rating ) ? $rating : 'Нет' ) ?></div> |
| 37 | </div> | 63 | </div> |
| 38 | <div class="ico-views-bl"> | 64 | <div class="ico-views-bl"> |
| 39 | <div class="portfolio-project-views-img-wr"> | 65 | <div class="portfolio-project-views-img-wr"> |
| 40 | <div class="portfolio-project-views-img"> | 66 | <div class="portfolio-project-views-img"> |
| 41 | <img src="/images/portfolio-project/ico-3.png"></div> | 67 | <img src="/images/portfolio-project/ico-3.png"></div> |
| 42 | </div> | 68 | </div> |
| 43 | - <div class="portfolio-project-views-txt">XX</div> | 69 | + <div class="portfolio-project-views-txt"><?= count($portfolio->comments) ?></div> |
| 44 | </div> | 70 | </div> |
| 45 | </div> | 71 | </div> |
| 46 | </div> | 72 | </div> |
| 47 | <div class="new-portfolio-rating"> | 73 | <div class="new-portfolio-rating"> |
| 48 | - <div class="rating new-portf-rat"> | ||
| 49 | - <!--оценка--> | ||
| 50 | - <input type="hidden" class="val" value="4"/> | ||
| 51 | - <!--количество голосов--> | ||
| 52 | - <input type="hidden" class="votes" value="12"/> | ||
| 53 | - </div> | 74 | + <?php |
| 75 | + echo StarRating::widget([ | ||
| 76 | + 'name' => 'rating_portfolio', | ||
| 77 | + 'value' => $rating, | ||
| 78 | + 'pluginOptions' => [ | ||
| 79 | + 'displayOnly' => true, | ||
| 80 | + 'size' => 'xxs', | ||
| 81 | + ], | ||
| 82 | + ]); | ||
| 83 | + ?> | ||
| 54 | </div> | 84 | </div> |
| 55 | </div> | 85 | </div> |
| 56 | 86 | ||
| 57 | <div class="new-portf-slider-wr style"> | 87 | <div class="new-portf-slider-wr style"> |
| 58 | <div class="new-portf-slider-title"><?= $portfolio->name ?></div> | 88 | <div class="new-portf-slider-title"><?= $portfolio->name ?></div> |
| 59 | <?php | 89 | <?php |
| 60 | - if(!empty( $portfolio->gallery ) || !empty( $portfolio->gallery->photo )) { | 90 | + if(!empty( $portfolio_user_gallery )) { |
| 91 | + ?> | ||
| 92 | + <div class="new-portf-slider style"> | ||
| 93 | + <div class="slider-video-wr"> | ||
| 94 | + <div id="demo5" class="scroll-img"> | ||
| 95 | + <ul> | ||
| 96 | + <?php | ||
| 97 | + foreach($portfolio_user_gallery as $one_photo) { | ||
| 98 | + ?> | ||
| 99 | + <li><img src="<?= $one_photo ?>" alt=""/></li> | ||
| 100 | + <?php | ||
| 101 | + } | ||
| 102 | + ?> | ||
| 103 | + </ul> | ||
| 104 | + </div> | ||
| 105 | + <div id="demo5-btn" class="text-center"> | ||
| 106 | + <button class="btn" id="demo5-backward"></button> | ||
| 107 | + <button class="btn" id="demo5-forward"></button> | ||
| 108 | + </div> | ||
| 109 | + </div> | ||
| 110 | + </div> | ||
| 111 | + <?php | ||
| 112 | + } elseif(empty( $portfolio_user ) && ( !empty( $portfolio->gallery ) || !empty( $portfolio->gallery->photo ) )) { | ||
| 61 | ?> | 113 | ?> |
| 62 | <div class="new-portf-slider style"> | 114 | <div class="new-portf-slider style"> |
| 63 | <div class="slider-video-wr"> | 115 | <div class="slider-video-wr"> |
| 64 | <div id="demo5" class="scroll-img"> | 116 | <div id="demo5" class="scroll-img"> |
| 65 | <ul> | 117 | <ul> |
| 66 | <?php | 118 | <?php |
| 67 | - foreach(explode(',', $portfolio->gallery->photo) as $one_photo) { | ||
| 68 | - if(empty( $one_photo )) { | ||
| 69 | - continue; | ||
| 70 | - } | 119 | + foreach($portfolio->ShowGallery($portfolio->gallery->photo) as $one_photo) { |
| 71 | ?> | 120 | ?> |
| 72 | <li><img src="<?= $one_photo ?>" alt=""/></li> | 121 | <li><img src="<?= $one_photo ?>" alt=""/></li> |
| 73 | <?php | 122 | <?php |
| @@ -86,45 +135,23 @@ | @@ -86,45 +135,23 @@ | ||
| 86 | ?> | 135 | ?> |
| 87 | </div> | 136 | </div> |
| 88 | <div style="clear: both"></div> | 137 | <div style="clear: both"></div> |
| 89 | - <style> | ||
| 90 | - .project-gallery-owl { | ||
| 91 | - width: calc(100% - 100px); | ||
| 92 | - margin: 0 50px; | ||
| 93 | - } | ||
| 94 | - </style> | ||
| 95 | - <div class="project-gallery-owl"> | ||
| 96 | - <?php | ||
| 97 | - for($i = 0; $i < 3; $i++) { | ||
| 98 | - foreach(explode(',', $portfolio->gallery->photo) as $one_photo) { | ||
| 99 | - if(empty( $one_photo )) { | ||
| 100 | - continue; | ||
| 101 | - } | ||
| 102 | - ?> | ||
| 103 | - <div class="item" style="background:url(<?=$one_photo?>);height:130px;width:180px;background-size:cover"></div> | ||
| 104 | - <?php | ||
| 105 | - } | ||
| 106 | - } | ||
| 107 | - ?> | ||
| 108 | - </div> | ||
| 109 | - <script> | ||
| 110 | - $('.project-gallery-owl').owlCarousel({loop:true, margin:10, nav:true, items: 3}); | ||
| 111 | - </script> | ||
| 112 | - | ||
| 113 | <div class="new-portfolio-txt-wrapper style"> | 138 | <div class="new-portfolio-txt-wrapper style"> |
| 114 | <div class="new-portfolio-excerpt style"> | 139 | <div class="new-portfolio-excerpt style"> |
| 115 | - <div class="new-portfolio-editor"> | ||
| 116 | - <?= $portfolio->preview ?> | ||
| 117 | - </div> | ||
| 118 | <?php | 140 | <?php |
| 119 | - if(!empty( $portfolio->description )) { | ||
| 120 | - ?> | ||
| 121 | - <div class="new-portfolio-see-all style"><span>Развернуть</span></div> | ||
| 122 | - <?php | 141 | + if(!empty( $portfolio_user ) && !empty( $portfolio_user->portfolioGallery ) && !empty( $portfolio_user->portfolioGallery->caption )) { |
| 142 | + echo Html::tag('div', $portfolio_user->portfolioGallery->caption, [ 'class' => 'new-portfolio-editor' ]); | ||
| 143 | + } else { | ||
| 144 | + echo Html::tag('div', $portfolio->preview, [ 'class' => 'new-portfolio-editor' ]); | ||
| 145 | + if(!empty( $portfolio->description )) { | ||
| 146 | + ?> | ||
| 147 | + <div class="new-portfolio-see-all style"><span>Развернуть</span></div> | ||
| 148 | + <?php | ||
| 149 | + } | ||
| 123 | } | 150 | } |
| 124 | ?> | 151 | ?> |
| 125 | </div> | 152 | </div> |
| 126 | <?php | 153 | <?php |
| 127 | - if(!empty( $portfolio->description )) { | 154 | + if(empty( $portfolio_user ) && !empty( $portfolio->description )) { |
| 128 | ?> | 155 | ?> |
| 129 | <div class="new-portfolio-txt"> | 156 | <div class="new-portfolio-txt"> |
| 130 | <div class="new-portfolio-editor"> | 157 | <div class="new-portfolio-editor"> |
| @@ -136,6 +163,34 @@ | @@ -136,6 +163,34 @@ | ||
| 136 | } | 163 | } |
| 137 | ?> | 164 | ?> |
| 138 | </div> | 165 | </div> |
| 166 | + <?php | ||
| 167 | + if(!empty( $portfolio->portfolioUsers )) { | ||
| 168 | + ?> | ||
| 169 | + <div class="new-portf-slider-wr style"> | ||
| 170 | + <p>Участники проекта:</p> | ||
| 171 | + <?php | ||
| 172 | + foreach($portfolio->portfolioUsers as $portfolioUser) { | ||
| 173 | + $gallery = $portfolio->ShowGallery($portfolioUser->gallery->photo); | ||
| 174 | + ?> | ||
| 175 | + <a href="<?= Url::to([ | ||
| 176 | + 'company/portfolio-view', | ||
| 177 | + 'company_id' => $user->id, | ||
| 178 | + 'portfolio_id' => $portfolio->portfolio_id, | ||
| 179 | + 'portfolio_user' => $portfolioUser->portfolio_user_id, | ||
| 180 | + ]) ?>"> | ||
| 181 | + <figure class="portfolio_user_figure"> | ||
| 182 | + <p><?= Html::img($portfolio->minImg(ArrayHelper::getValue($gallery, 0, ''), 'original'), [ 'class' => 'portfolio_user_image' ]) ?></p> | ||
| 183 | + <figcaption class="portfolio_user_caption"><?= $portfolioUser->user->name . ': ' . $portfolioUser->portfolioGallery->caption ?></figcaption> | ||
| 184 | + </figure> | ||
| 185 | + </a> | ||
| 186 | + <?php | ||
| 187 | + } | ||
| 188 | + ?> | ||
| 189 | + </div> | ||
| 190 | + <?php | ||
| 191 | + } | ||
| 192 | + Pjax::end(); | ||
| 193 | + ?> | ||
| 139 | 194 | ||
| 140 | <?php | 195 | <?php |
| 141 | echo \common\modules\comment\widgets\CommentWidget::widget([ | 196 | echo \common\modules\comment\widgets\CommentWidget::widget([ |
| @@ -163,198 +218,8 @@ | @@ -163,198 +218,8 @@ | ||
| 163 | ], | 218 | ], |
| 164 | ]); | 219 | ]); |
| 165 | ?> | 220 | ?> |
| 166 | - | ||
| 167 | - <?php | ||
| 168 | - /* | ||
| 169 | - ?> | ||
| 170 | - <div class="new-portf-comments-wr style"> | ||
| 171 | - <div class="new-portf-comm-count">Комментарии: 3</div> | ||
| 172 | - <div class="new-portf-add-comm style"> | ||
| 173 | - | ||
| 174 | - <form action=""> | ||
| 175 | - <div class="input-blocks-comm"> | ||
| 176 | - <label for="input-txt-5">Имя</label> | ||
| 177 | - <input class="custom-input-4" id="input-txt-5" type="text"> | ||
| 178 | - </div> | ||
| 179 | - <div class="input-blocks-comm"> | ||
| 180 | - | ||
| 181 | - <label for="input-txt-6">e-mail</label> | ||
| 182 | - <input class="custom-input-4" id="input-txt-6" type="text"> | ||
| 183 | - </div> | ||
| 184 | - <div class="input-blocks-comm area-comm"> | ||
| 185 | - <label for="input-txt-7">Комментарий</label> | ||
| 186 | - <textarea class="custom-area-4" id="input-txt-7"></textarea> | ||
| 187 | - </div> | ||
| 188 | - <div class="input-blocks-comm-button style"> | ||
| 189 | - <button type="submit" class="">Добавить комментраий</button> | ||
| 190 | - </div> | ||
| 191 | - </form> | ||
| 192 | - | ||
| 193 | - </div> | ||
| 194 | - | ||
| 195 | - <div class="new-portf-comm-read-wr style"> | ||
| 196 | - <div class="new-portf-comm-read"> | ||
| 197 | - <div class="style"> | ||
| 198 | - <div class="header-cabinet-foto"> | ||
| 199 | - <img src="/images/ded-ico.png" alt=""> | ||
| 200 | - </div> | ||
| 201 | - <div class="new-prof-wrapper-read"> | ||
| 202 | - <div class="new-portf-comm-read-title"><a href="#">Петер Цумтор</a></div> | ||
| 203 | - <div class="new-portf-comm-read-rating"> | ||
| 204 | - <div class="rating"> | ||
| 205 | - <!--оценка--> | ||
| 206 | - <input type="hidden" class="val" value="3"/> | ||
| 207 | - <!--количество голосов--> | ||
| 208 | - <input type="hidden" class="votes" value="12"/> | ||
| 209 | - </div> | ||
| 210 | - </div> | ||
| 211 | - <div class="blog-post-date"> | ||
| 212 | - <span></span> | ||
| 213 | - <p>22.09.2015</p> | ||
| 214 | - </div> | ||
| 215 | - </div> | ||
| 216 | - | ||
| 217 | - <div class="new-portf-answer"> | ||
| 218 | - <p>Балкон, обшитый вагонкой, выглядит аккуратно, стильно и уютно. Монтаж обшивки вполне возможно выполнить своими силами — достаточно иметь в распоряжении необходимые инструменты и владеть базовыми навыками строительно-ремонтных работ.</p> | ||
| 219 | - <p>Евровагонка — удобная в монтаже фасонная доска, которая позволяет создать обшивку из плотно пригнанных элементов с качественно обработанной поверхностью. Толщина евровагонки составляет 125 мм, общая ширина (с гребнем) 960 мм, рабочая ширина 880 мм.Балкон, обшитый вагонкой, выглядит аккуратно, стильно и уютно. Монтаж обшивки вполне возможно выполнить своими силами — достаточно иметь в распоряжении необходимые инструменты и владеть базовыми навыками строительно-ремонтных работ.</p> | ||
| 220 | - </div> | ||
| 221 | - | ||
| 222 | - </div> | ||
| 223 | - <div class="style"></div> | ||
| 224 | - </div> | ||
| 225 | - | ||
| 226 | - <div class="new-portf-comm-read"> | ||
| 227 | - <div class="style"> | ||
| 228 | - <div class="header-cabinet-foto"> | ||
| 229 | - <img src="/images/ded-ico.png" alt=""> | ||
| 230 | - </div> | ||
| 231 | - <div class="new-prof-wrapper-read"> | ||
| 232 | - <div class="new-portf-comm-read-title"><a href="#">Петер Цумтор</a></div> | ||
| 233 | - <div class="new-portf-comm-read-rating"> | ||
| 234 | - <div class="rating"> | ||
| 235 | - <!--оценка--> | ||
| 236 | - <input type="hidden" class="val" value="4"/> | ||
| 237 | - <!--количество голосов--> | ||
| 238 | - <input type="hidden" class="votes" value="12"/> | ||
| 239 | - </div> | ||
| 240 | - </div> | ||
| 241 | - <div class="blog-post-date"> | ||
| 242 | - <span></span> | ||
| 243 | - <p>22.09.2015</p> | ||
| 244 | - </div> | ||
| 245 | - </div> | ||
| 246 | - | ||
| 247 | - <div class="new-portf-answer"> | ||
| 248 | - <p>Балкон, обшитый вагонкой, выглядит аккуратно, стильно и уютно. Монтаж обшивки вполне возможно выполнить своими силами — достаточно иметь в распоряжении необходимые инструменты и владеть базовыми навыками строительно-ремонтных работ.</p> | ||
| 249 | - <p>Евровагонка — удобная в монтаже фасонная доска, которая позволяет создать обшивку из плотно пригнанных элементов с качественно обработанной поверхностью. Толщина евровагонки составляет 125 мм, общая ширина (с гребнем) 960 мм, рабочая ширина 880 мм.Балкон, обшитый вагонкой, выглядит аккуратно, стильно и уютно. Монтаж обшивки вполне возможно выполнить своими силами — достаточно иметь в распоряжении необходимые инструменты и владеть базовыми навыками строительно-ремонтных работ.</p> | ||
| 250 | - </div> | ||
| 251 | - | ||
| 252 | - </div> | ||
| 253 | - <div class="style"></div> | ||
| 254 | - </div> | ||
| 255 | - | ||
| 256 | - <div class="new-portf-comm-read"> | ||
| 257 | - <div class="style"> | ||
| 258 | - <div class="header-cabinet-foto"> | ||
| 259 | - <img src="/images/ded-ico.png" alt=""> | ||
| 260 | - </div> | ||
| 261 | - <div class="new-prof-wrapper-read"> | ||
| 262 | - <div class="new-portf-comm-read-title"><a href="#">Петер Цумтор</a></div> | ||
| 263 | - <div class="new-portf-comm-read-rating"> | ||
| 264 | - <div class="rating"> | ||
| 265 | - <!--оценка--> | ||
| 266 | - <input type="hidden" class="val" value="5"/> | ||
| 267 | - <!--количество голосов--> | ||
| 268 | - <input type="hidden" class="votes" value="12"/> | ||
| 269 | - </div> | ||
| 270 | - </div> | ||
| 271 | - <div class="blog-post-date"> | ||
| 272 | - <span></span> | ||
| 273 | - <p>22.09.2015</p> | ||
| 274 | - </div> | ||
| 275 | - </div> | ||
| 276 | - | ||
| 277 | - <div class="new-portf-answer"> | ||
| 278 | - <p>Балкон, обшитый вагонкой, выглядит аккуратно, стильно и уютно. Монтаж обшивки вполне возможно выполнить своими силами — достаточно иметь в распоряжении необходимые инструменты и владеть базовыми навыками строительно-ремонтных работ.</p> | ||
| 279 | - <p>Евровагонка — удобная в монтаже фасонная доска, которая позволяет создать обшивку из плотно пригнанных элементов с качественно обработанной поверхностью. Толщина евровагонки составляет 125 мм, общая ширина (с гребнем) 960 мм, рабочая ширина 880 мм.Балкон, обшитый вагонкой, выглядит аккуратно, стильно и уютно. Монтаж обшивки вполне возможно выполнить своими силами — достаточно иметь в распоряжении необходимые инструменты и владеть базовыми навыками строительно-ремонтных работ.</p> | ||
| 280 | - </div> | ||
| 281 | - | ||
| 282 | - </div> | ||
| 283 | - <div class="style"></div> | ||
| 284 | - </div> | ||
| 285 | - | ||
| 286 | - <div class="new-portf-comm-read"> | ||
| 287 | - <div class="style"> | ||
| 288 | - <div class="header-cabinet-foto"> | ||
| 289 | - <img src="/images/ded-ico.png" alt=""> | ||
| 290 | - </div> | ||
| 291 | - <div class="new-prof-wrapper-read"> | ||
| 292 | - <div class="new-portf-comm-read-title"><a href="#">Петер Цумтор</a></div> | ||
| 293 | - <div class="new-portf-comm-read-rating"> | ||
| 294 | - <div class="rating"> | ||
| 295 | - <!--оценка--> | ||
| 296 | - <input type="hidden" class="val" value="1"/> | ||
| 297 | - <!--количество голосов--> | ||
| 298 | - <input type="hidden" class="votes" value="12"/> | ||
| 299 | - </div> | ||
| 300 | - </div> | ||
| 301 | - <div class="blog-post-date"> | ||
| 302 | - <span></span> | ||
| 303 | - <p>22.09.2015</p> | ||
| 304 | - </div> | ||
| 305 | - </div> | ||
| 306 | - | ||
| 307 | - <div class="new-portf-answer"> | ||
| 308 | - <p>Балкон, обшитый вагонкой, выглядит аккуратно, стильно и уютно. Монтаж обшивки вполне возможно выполнить своими силами — достаточно иметь в распоряжении необходимые инструменты и владеть базовыми навыками строительно-ремонтных работ.</p> | ||
| 309 | - <p>Евровагонка — удобная в монтаже фасонная доска, которая позволяет создать обшивку из плотно пригнанных элементов с качественно обработанной поверхностью. Толщина евровагонки составляет 125 мм, общая ширина (с гребнем) 960 мм, рабочая ширина 880 мм.Балкон, обшитый вагонкой, выглядит аккуратно, стильно и уютно. Монтаж обшивки вполне возможно выполнить своими силами — достаточно иметь в распоряжении необходимые инструменты и владеть базовыми навыками строительно-ремонтных работ.</p> | ||
| 310 | - </div> | ||
| 311 | - | ||
| 312 | - </div> | ||
| 313 | - <div class="style"></div> | ||
| 314 | - </div> | ||
| 315 | - <div class="new-portf-comm-read"> | ||
| 316 | - <div class="style"> | ||
| 317 | - <div class="header-cabinet-foto"> | ||
| 318 | - <img src="/images/ded-ico.png" alt=""> | ||
| 319 | - </div> | ||
| 320 | - <div class="new-prof-wrapper-read"> | ||
| 321 | - <div class="new-portf-comm-read-title"><a href="#">Петер Цумтор</a></div> | ||
| 322 | - <div class="new-portf-comm-read-rating"> | ||
| 323 | - <div class="rating"> | ||
| 324 | - <!--оценка--> | ||
| 325 | - <input type="hidden" class="val" value="2"/> | ||
| 326 | - <!--количество голосов--> | ||
| 327 | - <input type="hidden" class="votes" value="12"/> | ||
| 328 | - </div> | ||
| 329 | - </div> | ||
| 330 | - <div class="blog-post-date"> | ||
| 331 | - <span></span> | ||
| 332 | - <p>22.09.2015</p> | ||
| 333 | - </div> | ||
| 334 | - </div> | ||
| 335 | - | ||
| 336 | - <div class="new-portf-answer"> | ||
| 337 | - <p>Балкон, обшитый вагонкой, выглядит аккуратно, стильно и уютно. Монтаж обшивки вполне возможно выполнить своими силами — достаточно иметь в распоряжении необходимые инструменты и владеть базовыми навыками строительно-ремонтных работ.</p> | ||
| 338 | - <p>Евровагонка — удобная в монтаже фасонная доска, которая позволяет создать обшивку из плотно пригнанных элементов с качественно обработанной поверхностью. Толщина евровагонки составляет 125 мм, общая ширина (с гребнем) 960 мм, рабочая ширина 880 мм.Балкон, обшитый вагонкой, выглядит аккуратно, стильно и уютно. Монтаж обшивки вполне возможно выполнить своими силами — достаточно иметь в распоряжении необходимые инструменты и владеть базовыми навыками строительно-ремонтных работ.</p> | ||
| 339 | - </div> | ||
| 340 | - | ||
| 341 | - </div> | ||
| 342 | - <div class="style"></div> | ||
| 343 | - </div> | ||
| 344 | - | ||
| 345 | - </div> | ||
| 346 | - </div> | ||
| 347 | - */ | ||
| 348 | - ?> | ||
| 349 | </div> | 221 | </div> |
| 350 | <script> | 222 | <script> |
| 351 | - $('.portfolio-new-page-wrapper .rating').rating( | ||
| 352 | - { | ||
| 353 | - fx : 'full', readOnly : false, url : 'rating.php' | ||
| 354 | - } | ||
| 355 | - ); | ||
| 356 | -</script> | ||
| 357 | -<script> | ||
| 358 | $(document).ready( | 223 | $(document).ready( |
| 359 | function() | 224 | function() |
| 360 | { | 225 | { |
frontend/views/company/portfolio.php
| 1 | <?php | 1 | <?php |
| 2 | 2 | ||
| 3 | - use yii\helpers\ArrayHelper; | 3 | + use common\models\Specialization; |
| 4 | + use common\models\User; | ||
| 5 | + use yii\data\ActiveDataProvider; | ||
| 4 | use \yii\helpers\Html; | 6 | use \yii\helpers\Html; |
| 5 | use yii\helpers\Url; | 7 | use yii\helpers\Url; |
| 6 | use yii\widgets\ListView; | 8 | use yii\widgets\ListView; |
| 7 | use yii\widgets\Pjax; | 9 | use yii\widgets\Pjax; |
| 8 | 10 | ||
| 9 | - /* @var $this yii\web\View | ||
| 10 | - * @var $portfolio yii\data\ArrayDataProvider | 11 | + /** |
| 12 | + * @var yii\web\View $this | ||
| 13 | + * @var User $company | ||
| 14 | + * @var ActiveDataProvider $portfolio | ||
| 15 | + * @var array $filters | ||
| 16 | + * @var int $filter_id | ||
| 11 | */ | 17 | */ |
| 12 | $this->params[ 'company' ] = $company; | 18 | $this->params[ 'company' ] = $company; |
| 13 | $this->title = 'My Yii Application'; | 19 | $this->title = 'My Yii Application'; |
| @@ -18,22 +24,23 @@ | @@ -18,22 +24,23 @@ | ||
| 18 | Pjax::begin(); | 24 | Pjax::begin(); |
| 19 | ?> | 25 | ?> |
| 20 | <div class="portfolio-project-wr style"> | 26 | <div class="portfolio-project-wr style"> |
| 21 | - <div class="workplace-title style"><p>Проектов: <?= $portfolio->totalCount ?></p></div> | 27 | + <div class="workplace-title style"> |
| 28 | + <p><?= Yii::t('app', 'Projects') ?>: <?= $portfolio->totalCount ?></p></div> | ||
| 22 | <div class="portfolio-project-tags style"> | 29 | <div class="portfolio-project-tags style"> |
| 23 | - <?= Html::a("Все ({$count})", [ | 30 | + <?= Html::a("Все (".count($company->portfolios).")", [ |
| 24 | 'company/portfolio', | 31 | 'company/portfolio', |
| 25 | 'company_id' => $company->id, | 32 | 'company_id' => $company->id, |
| 26 | - 'type' => ( !empty( $this->params[ 'type' ] ) ) ? $this->params[ 'type' ] : NULL, | 33 | + 'type' => ( !empty( $this->params[ 'type' ] ) ) ? $this->params[ 'type' ] : NULL, |
| 27 | ], [ 'class' => !isset( $filter_id ) || empty( $filter_id ) ? "active-tag" : "" ]); ?> | 34 | ], [ 'class' => !isset( $filter_id ) || empty( $filter_id ) ? "active-tag" : "" ]); ?> |
| 28 | <a href="#" class="active-tag"></a> | 35 | <a href="#" class="active-tag"></a> |
| 29 | - <?php foreach($filters as $filter): ?> | ||
| 30 | - <?= Html::a("{$filter->specialization->specialization_name} ({$filter->count})", Url::toRoute([ | 36 | + <?php foreach($filters as $filter) { |
| 37 | + echo Html::a("{$filter['specialization_name']} ({$filter['count']})", Url::toRoute([ | ||
| 31 | 'company/portfolio-filter', | 38 | 'company/portfolio-filter', |
| 32 | 'company_id' => $company->id, | 39 | 'company_id' => $company->id, |
| 33 | - 'filter' => $filter->specialization->specialization_id, | ||
| 34 | - 'type' => ( !empty( $this->params[ 'type' ] ) ) ? $this->params[ 'type' ] : NULL, | ||
| 35 | - ]), [ 'class' => isset( $filter_id ) && $filter->specialization->specialization_id == $filter_id ? "active-tag" : "" ]); ?> | ||
| 36 | - <?php endforeach; ?> | 40 | + 'filter' => $filter['specialization_id'], |
| 41 | + 'type' => ( !empty( $this->params[ 'type' ] ) ) ? $this->params[ 'type' ] : NULL, | ||
| 42 | + ]), [ 'class' => isset( $filter_id ) && $filter['specialization_id'] == $filter_id ? "active-tag" : "" ]); | ||
| 43 | + } ?> | ||
| 37 | 44 | ||
| 38 | </div> | 45 | </div> |
| 39 | </div> | 46 | </div> |
frontend/views/performer/portfolio-view.php
| 1 | <?php | 1 | <?php |
| 2 | 2 | ||
| 3 | use common\models\Portfolio; | 3 | use common\models\Portfolio; |
| 4 | + use common\models\PortfolioUser; | ||
| 4 | use common\models\User; | 5 | use common\models\User; |
| 5 | use kartik\rating\StarRating; | 6 | use kartik\rating\StarRating; |
| 7 | + use yii\helpers\ArrayHelper; | ||
| 6 | use yii\helpers\Html; | 8 | use yii\helpers\Html; |
| 9 | + use yii\helpers\Url; | ||
| 7 | use yii\web\ViewAction; | 10 | use yii\web\ViewAction; |
| 8 | use yii\web\View; | 11 | use yii\web\View; |
| 12 | + use yii\widgets\Pjax; | ||
| 9 | 13 | ||
| 10 | /** | 14 | /** |
| 11 | - * @var ViewAction $this | ||
| 12 | - * @var User $user | ||
| 13 | - * @var Portfolio $portfolio | ||
| 14 | - * @var View $this | 15 | + * @var ViewAction $this |
| 16 | + * @var User $user | ||
| 17 | + * @var Portfolio $portfolio | ||
| 18 | + * @var View $this | ||
| 19 | + * @var PortfolioUser $portfolio_user | ||
| 15 | */ | 20 | */ |
| 16 | $this->params[ 'user' ] = $user; | 21 | $this->params[ 'user' ] = $user; |
| 17 | 22 | ||
| 18 | $this->title = 'My Yii Application'; | 23 | $this->title = 'My Yii Application'; |
| 19 | $rating = $portfolio->getRatingValue(); | 24 | $rating = $portfolio->getRatingValue(); |
| 25 | + if(!empty( $portfolio_user )) { | ||
| 26 | + $portfolio_user_gallery = $portfolio->ShowGallery($portfolio_user->gallery->photo); | ||
| 27 | + } | ||
| 20 | ?> | 28 | ?> |
| 21 | <div class="portfolio-new-page-wrapper style"> | 29 | <div class="portfolio-new-page-wrapper style"> |
| 30 | + <?php | ||
| 31 | + Pjax::begin(); | ||
| 32 | + if(!empty( $portfolio_user )) { | ||
| 33 | + echo Html::a('Вернуться к основной запаси', [ | ||
| 34 | + 'company/portfolio-view', | ||
| 35 | + 'company_id' => $user->id, | ||
| 36 | + 'portfolio_id' => $portfolio->portfolio_id, | ||
| 37 | + ]); | ||
| 38 | + } | ||
| 39 | + ?> | ||
| 22 | <div class="new-portfolio-bg style "> | 40 | <div class="new-portfolio-bg style "> |
| 23 | <?php | 41 | <?php |
| 24 | - echo Html::img($portfolio->minImg($portfolio->cover, '720', '280')) | 42 | + if(!empty( $portfolio_user )) { |
| 43 | + echo Html::img($portfolio->minImg(ArrayHelper::getValue($portfolio_user_gallery, 0, ''), '720', '280')); | ||
| 44 | + } else { | ||
| 45 | + echo Html::img($portfolio->minImg($portfolio->cover, '720', '280')); | ||
| 46 | + } | ||
| 25 | ?> | 47 | ?> |
| 26 | </div> | 48 | </div> |
| 27 | <div class="new-portfolio-icons-rating-wr style"> | 49 | <div class="new-portfolio-icons-rating-wr style"> |
| @@ -54,7 +76,7 @@ | @@ -54,7 +76,7 @@ | ||
| 54 | <?php | 76 | <?php |
| 55 | echo StarRating::widget([ | 77 | echo StarRating::widget([ |
| 56 | 'name' => 'rating_portfolio', | 78 | 'name' => 'rating_portfolio', |
| 57 | - 'value' => $portfolio->getRatingValue(), | 79 | + 'value' => $rating, |
| 58 | 'pluginOptions' => [ | 80 | 'pluginOptions' => [ |
| 59 | 'displayOnly' => true, | 81 | 'displayOnly' => true, |
| 60 | 'size' => 'xxs', | 82 | 'size' => 'xxs', |
| @@ -67,21 +89,41 @@ | @@ -67,21 +89,41 @@ | ||
| 67 | <div class="new-portf-slider-wr style"> | 89 | <div class="new-portf-slider-wr style"> |
| 68 | <div class="new-portf-slider-title"><?= $portfolio->name ?></div> | 90 | <div class="new-portf-slider-title"><?= $portfolio->name ?></div> |
| 69 | <?php | 91 | <?php |
| 70 | - if(!empty( $portfolio->gallery ) || !empty( $portfolio->gallery->photo )) { | ||
| 71 | - $gallery = explode(',', $portfolio->gallery->photo); | ||
| 72 | - array_pop($gallery); | 92 | + if(!empty( $portfolio_user_gallery )) { |
| 93 | + ?> | ||
| 94 | + <div class="new-portf-slider style"> | ||
| 95 | + <div class="slider-video-wr"> | ||
| 96 | + <div id="demo5" class="scroll-img"> | ||
| 97 | + <ul> | ||
| 98 | + <?php | ||
| 99 | + foreach($portfolio_user_gallery as $one_photo) { | ||
| 100 | + ?> | ||
| 101 | + <li><img src="<?= $one_photo ?>" alt=""/></li> | ||
| 102 | + <?php | ||
| 103 | + } | ||
| 104 | + ?> | ||
| 105 | + </ul> | ||
| 106 | + </div> | ||
| 107 | + <div id="demo5-btn" class="text-center"> | ||
| 108 | + <button class="btn" id="demo5-backward"></button> | ||
| 109 | + <button class="btn" id="demo5-forward"></button> | ||
| 110 | + </div> | ||
| 111 | + </div> | ||
| 112 | + </div> | ||
| 113 | + <?php | ||
| 114 | + } elseif(empty( $portfolio_user ) && ( !empty( $portfolio->gallery ) || !empty( $portfolio->gallery->photo ) )) { | ||
| 73 | ?> | 115 | ?> |
| 74 | <div class="new-portf-slider style"> | 116 | <div class="new-portf-slider style"> |
| 75 | <div class="slider-video-wr"> | 117 | <div class="slider-video-wr"> |
| 76 | <div id="demo5" class="scroll-img"> | 118 | <div id="demo5" class="scroll-img"> |
| 77 | <ul> | 119 | <ul> |
| 78 | <?php | 120 | <?php |
| 79 | - foreach( $gallery as $one_photo ) { | 121 | + foreach($portfolio->ShowGallery($portfolio->gallery->photo) as $one_photo) { |
| 122 | + ?> | ||
| 123 | + <li><img src="<?= $one_photo ?>" alt=""/></li> | ||
| 124 | + <?php | ||
| 125 | + } | ||
| 80 | ?> | 126 | ?> |
| 81 | - <li><img src="<?= $one_photo ?>" alt=""/> | ||
| 82 | - <?php | ||
| 83 | - } | ||
| 84 | - ?> | ||
| 85 | </ul> | 127 | </ul> |
| 86 | </div> | 128 | </div> |
| 87 | <div id="demo5-btn" class="text-center"> | 129 | <div id="demo5-btn" class="text-center"> |
| @@ -97,19 +139,21 @@ | @@ -97,19 +139,21 @@ | ||
| 97 | 139 | ||
| 98 | <div class="new-portfolio-txt-wrapper style"> | 140 | <div class="new-portfolio-txt-wrapper style"> |
| 99 | <div class="new-portfolio-excerpt style"> | 141 | <div class="new-portfolio-excerpt style"> |
| 100 | - <div class="new-portfolio-editor"> | ||
| 101 | - <?= $portfolio->preview ?> | ||
| 102 | - </div> | ||
| 103 | <?php | 142 | <?php |
| 104 | - if(!empty( $portfolio->description )) { | ||
| 105 | - ?> | ||
| 106 | - <div class="new-portfolio-see-all style"><span>Развернуть</span></div> | ||
| 107 | - <?php | 143 | + if(!empty( $portfolio_user ) && !empty( $portfolio_user->portfolioGallery ) && !empty( $portfolio_user->portfolioGallery->caption )) { |
| 144 | + echo Html::tag('div', $portfolio_user->portfolioGallery->caption, [ 'class' => 'new-portfolio-editor' ]); | ||
| 145 | + } else { | ||
| 146 | + echo Html::tag('div', $portfolio->preview, [ 'class' => 'new-portfolio-editor' ]); | ||
| 147 | + if(!empty( $portfolio->description )) { | ||
| 148 | + ?> | ||
| 149 | + <div class="new-portfolio-see-all style"><span>Развернуть</span></div> | ||
| 150 | + <?php | ||
| 151 | + } | ||
| 108 | } | 152 | } |
| 109 | ?> | 153 | ?> |
| 110 | </div> | 154 | </div> |
| 111 | <?php | 155 | <?php |
| 112 | - if(!empty( $portfolio->description )) { | 156 | + if(empty( $portfolio_user ) && !empty( $portfolio->description )) { |
| 113 | ?> | 157 | ?> |
| 114 | <div class="new-portfolio-txt"> | 158 | <div class="new-portfolio-txt"> |
| 115 | <div class="new-portfolio-editor"> | 159 | <div class="new-portfolio-editor"> |
| @@ -122,6 +166,34 @@ | @@ -122,6 +166,34 @@ | ||
| 122 | ?> | 166 | ?> |
| 123 | </div> | 167 | </div> |
| 124 | <?php | 168 | <?php |
| 169 | + if(!empty( $portfolio->portfolioUsers )) { | ||
| 170 | + ?> | ||
| 171 | + <div class="new-portf-slider-wr style"> | ||
| 172 | + <p>Участники проекта:</p> | ||
| 173 | + <?php | ||
| 174 | + foreach($portfolio->portfolioUsers as $portfolioUser) { | ||
| 175 | + $gallery = $portfolio->ShowGallery($portfolioUser->gallery->photo); | ||
| 176 | + ?> | ||
| 177 | + <a href="<?= Url::to([ | ||
| 178 | + 'performer/portfolio-view', | ||
| 179 | + 'performer_id' => $user->id, | ||
| 180 | + 'portfolio_id' => $portfolio->portfolio_id, | ||
| 181 | + 'portfolio_user' => $portfolioUser->portfolio_user_id, | ||
| 182 | + ]) ?>"> | ||
| 183 | + <figure class="portfolio_user_figure"> | ||
| 184 | + <p><?= Html::img($portfolio->minImg(ArrayHelper::getValue($gallery, 0, ''), 'original'), [ 'class' => 'portfolio_user_image' ]) ?></p> | ||
| 185 | + <figcaption class="portfolio_user_caption"><?= $portfolioUser->user->name . ': ' . $portfolioUser->portfolioGallery->caption ?></figcaption> | ||
| 186 | + </figure> | ||
| 187 | + </a> | ||
| 188 | + <?php | ||
| 189 | + } | ||
| 190 | + ?> | ||
| 191 | + </div> | ||
| 192 | + <?php | ||
| 193 | + } | ||
| 194 | + Pjax::end(); | ||
| 195 | + ?> | ||
| 196 | + <?php | ||
| 125 | echo \common\modules\comment\widgets\CommentWidget::widget([ | 197 | echo \common\modules\comment\widgets\CommentWidget::widget([ |
| 126 | 'context' => $this, | 198 | 'context' => $this, |
| 127 | 'model' => $portfolio::className(), | 199 | 'model' => $portfolio::className(), |
| @@ -151,13 +223,6 @@ | @@ -151,13 +223,6 @@ | ||
| 151 | 223 | ||
| 152 | </div> | 224 | </div> |
| 153 | <script> | 225 | <script> |
| 154 | - $('.portfolio-new-page-wrapper .rating').rating( | ||
| 155 | - { | ||
| 156 | - fx : 'full', readOnly : false, url : 'rating.php' | ||
| 157 | - } | ||
| 158 | - ); | ||
| 159 | -</script> | ||
| 160 | -<script> | ||
| 161 | $(document).ready( | 226 | $(document).ready( |
| 162 | function() | 227 | function() |
| 163 | { | 228 | { |
frontend/views/performer/portfolio.php
| @@ -18,7 +18,7 @@ | @@ -18,7 +18,7 @@ | ||
| 18 | Pjax::begin(); | 18 | Pjax::begin(); |
| 19 | ?> | 19 | ?> |
| 20 | <div class="portfolio-project-wr style"> | 20 | <div class="portfolio-project-wr style"> |
| 21 | - <div class="workplace-title style"><p>Проектов: <?= $portfolio->totalCount ?></p></div> | 21 | + <div class="workplace-title style"><p><?=Yii::t('app', 'Projects')?>: <?= $portfolio->totalCount ?></p></div> |
| 22 | <div class="portfolio-project-tags style"> | 22 | <div class="portfolio-project-tags style"> |
| 23 | <?= Html::a("Все ({$count})", [ | 23 | <?= Html::a("Все ({$count})", [ |
| 24 | 'performer/portfolio', | 24 | 'performer/portfolio', |
frontend/web/css/style.css
| @@ -4145,6 +4145,7 @@ input[type=file]::-webkit-file-upload-button { | @@ -4145,6 +4145,7 @@ input[type=file]::-webkit-file-upload-button { | ||
| 4145 | } | 4145 | } |
| 4146 | 4146 | ||
| 4147 | .portfolio-project-blocks-title-wr { | 4147 | .portfolio-project-blocks-title-wr { |
| 4148 | + overflow: hidden; | ||
| 4148 | height: 41px; | 4149 | height: 41px; |
| 4149 | width: 100%; | 4150 | width: 100%; |
| 4150 | box-sizing: border-box; | 4151 | box-sizing: border-box; |
| @@ -7955,6 +7956,8 @@ input.disabled.admin-check:checked + label, input.disabled.admin-check:checked + | @@ -7955,6 +7956,8 @@ input.disabled.admin-check:checked + label, input.disabled.admin-check:checked + | ||
| 7955 | } | 7956 | } |
| 7956 | 7957 | ||
| 7957 | .new-portf-slider-title { | 7958 | .new-portf-slider-title { |
| 7959 | + text-overflow: ellipsis; | ||
| 7960 | + overflow: hidden; | ||
| 7958 | font-size: 24px | 7961 | font-size: 24px |
| 7959 | } | 7962 | } |
| 7960 | 7963 | ||
| @@ -12254,6 +12257,17 @@ li.active-menu-admin:hover a .ico_num { | @@ -12254,6 +12257,17 @@ li.active-menu-admin:hover a .ico_num { | ||
| 12254 | top: 50px; | 12257 | top: 50px; |
| 12255 | z-index: 10; | 12258 | z-index: 10; |
| 12256 | } | 12259 | } |
| 12260 | +.portfolio_user_figure { | ||
| 12261 | + width: 25%; | ||
| 12262 | + padding: 0 10px; | ||
| 12263 | + display: inline-block; | ||
| 12264 | +} | ||
| 12265 | +.portfolio_user_figure .portfolio_user_image { | ||
| 12266 | + width: 100%; | ||
| 12267 | +} | ||
| 12268 | +.portfolio_user_figure .portfolio_user_caption { | ||
| 12269 | + text-align: center; | ||
| 12270 | +} | ||
| 12257 | /*.field-portfolio-cover.has-error.success_download .help-block {*/ | 12271 | /*.field-portfolio-cover.has-error.success_download .help-block {*/ |
| 12258 | /*display: none;*/ | 12272 | /*display: none;*/ |
| 12259 | /*}*/ | 12273 | /*}*/ |
| 12260 | \ No newline at end of file | 12274 | \ No newline at end of file |