Commit e715603324e229716251149802672f5bf43b7583
1 parent
2e35d6bd
test
Showing
3 changed files
with
336 additions
and
279 deletions
Show diff stats
common/models/Portfolio.php
| @@ -179,6 +179,6 @@ | @@ -179,6 +179,6 @@ | ||
| 179 | 179 | ||
| 180 | public function getGallery() | 180 | public function getGallery() |
| 181 | { | 181 | { |
| 182 | - $this->hasOne(Gallery::className(), ['gallery_id' => 'gallery_id']); | 182 | + return $this->hasOne(Gallery::className(), ['gallery_id' => 'gallery_id']); |
| 183 | } | 183 | } |
| 184 | } | 184 | } |
frontend/controllers/PerformerController.php
| 1 | <?php | 1 | <?php |
| 2 | -namespace frontend\controllers; | ||
| 3 | - | ||
| 4 | -use common\models\Blog; | ||
| 5 | -use common\models\Fields; | ||
| 6 | -use common\models\Gallery; | ||
| 7 | -use common\models\Portfolio; | ||
| 8 | -use common\models\PortfolioSpecialization; | ||
| 9 | -use Yii; | ||
| 10 | -use yii\data\ArrayDataProvider; | ||
| 11 | -use yii\data\Pagination; | ||
| 12 | -use yii\helpers\ArrayHelper; | ||
| 13 | -use yii\web\BadRequestHttpException; | ||
| 14 | -use yii\web\Controller; | ||
| 15 | -use common\models\User; | ||
| 16 | - | ||
| 17 | - | ||
| 18 | - | ||
| 19 | -/** | ||
| 20 | - * Site controller | ||
| 21 | - */ | ||
| 22 | -class PerformerController extends Controller | ||
| 23 | -{ | ||
| 24 | - public $layout = 'performer'; | ||
| 25 | - public $user; | ||
| 26 | - public $defaultAction = 'common'; | ||
| 27 | - | ||
| 28 | - public function afterAction($action, $result) | ||
| 29 | - { | ||
| 30 | - if(!empty($action->controller->actionParams['performer_id'])) { | ||
| 31 | - $performer_id = $action->controller->actionParams['performer_id']; | ||
| 32 | - $user = User::findOne($performer_id); | ||
| 33 | - if(!empty($user->userInfo)) { | ||
| 34 | - $user->userInfo->updateCounters(['view_count' => 1]); | ||
| 35 | - } | ||
| 36 | - } | ||
| 37 | - return parent::afterAction($action, $result); | ||
| 38 | - } | 2 | + namespace frontend\controllers; |
| 3 | + | ||
| 4 | + use common\models\Blog; | ||
| 5 | + use common\models\Fields; | ||
| 6 | + use common\models\Gallery; | ||
| 7 | + use common\models\Portfolio; | ||
| 8 | + use common\models\PortfolioSpecialization; | ||
| 9 | + use Yii; | ||
| 10 | + use yii\data\ArrayDataProvider; | ||
| 11 | + use yii\data\Pagination; | ||
| 12 | + use yii\helpers\ArrayHelper; | ||
| 13 | + use yii\web\BadRequestHttpException; | ||
| 14 | + use yii\web\Controller; | ||
| 15 | + use common\models\User; | ||
| 39 | 16 | ||
| 40 | /** | 17 | /** |
| 41 | - * @inheritdoc | 18 | + * Site controller |
| 42 | */ | 19 | */ |
| 43 | - public function actions() | 20 | + class PerformerController extends Controller |
| 44 | { | 21 | { |
| 45 | - return [ | ||
| 46 | - 'error' => [ | ||
| 47 | - 'class' => 'yii\web\ErrorAction', | ||
| 48 | - ], | ||
| 49 | - 'captcha' => [ | ||
| 50 | - 'class' => 'yii\captcha\CaptchaAction', | ||
| 51 | - 'fixedVerifyCode' => YII_ENV_TEST ? 'testme' : null, | ||
| 52 | - ], | ||
| 53 | - ]; | ||
| 54 | - } | ||
| 55 | 22 | ||
| 56 | - public function actionCommon($performer_id) | ||
| 57 | - { | 23 | + public $layout = 'performer'; |
| 58 | 24 | ||
| 59 | - $user = User::findOne($performer_id); | 25 | + public $user; |
| 60 | 26 | ||
| 61 | - if(!$user instanceof User){ | ||
| 62 | - throw new BadRequestHttpException('ะะพะปัะทะพะฒะฐัะตะปั ะฝะต ะฝะฐะนะดะตะฝ'); | ||
| 63 | - } | ||
| 64 | - | ||
| 65 | - $educations = Fields::getData($user->id,$user->className(),'education'); | ||
| 66 | - $phones = Fields::getData($user->id,$user->className(),'phone'); | ||
| 67 | - $sites = Fields::getData($user->id,$user->className(),'site'); | ||
| 68 | - $soft = implode(', ',ArrayHelper::getColumn(Fields::getData($user->id,$user->className(),'soft'), 'soft')); | ||
| 69 | - | ||
| 70 | - return $this->render('common',[ | ||
| 71 | - 'user' => $user, | ||
| 72 | - 'educations' => $educations, | ||
| 73 | - 'phones' => $phones, | ||
| 74 | - 'sites' => $sites, | ||
| 75 | - 'soft' => $soft | ||
| 76 | - ]); | ||
| 77 | - | ||
| 78 | - | ||
| 79 | - } | ||
| 80 | - | ||
| 81 | - public function actionPortfolio($performer_id) | ||
| 82 | - { | ||
| 83 | - $user = User::findOne($performer_id); | 27 | + public $defaultAction = 'common'; |
| 84 | 28 | ||
| 85 | - if(!$user instanceof User){ | ||
| 86 | - throw new BadRequestHttpException('ะะพะปัะทะพะฒะฐัะตะปั ะฝะต ะฝะฐะนะดะตะฝ'); | 29 | + public function afterAction($action, $result) |
| 30 | + { | ||
| 31 | + if(!empty( $action->controller->actionParams[ 'performer_id' ] )) { | ||
| 32 | + $performer_id = $action->controller->actionParams[ 'performer_id' ]; | ||
| 33 | + $user = User::findOne($performer_id); | ||
| 34 | + if(!empty( $user->userInfo )) { | ||
| 35 | + $user->userInfo->updateCounters([ 'view_count' => 1 ]); | ||
| 36 | + } | ||
| 37 | + } | ||
| 38 | + return parent::afterAction($action, $result); | ||
| 87 | } | 39 | } |
| 88 | - $projects = ArrayHelper::getColumn($user->portfolios,'portfolio_id'); | ||
| 89 | 40 | ||
| 41 | + /** | ||
| 42 | + * @inheritdoc | ||
| 43 | + */ | ||
| 44 | + public function actions() | ||
| 45 | + { | ||
| 46 | + return [ | ||
| 47 | + 'error' => [ | ||
| 48 | + 'class' => 'yii\web\ErrorAction', | ||
| 49 | + ], | ||
| 50 | + 'captcha' => [ | ||
| 51 | + 'class' => 'yii\captcha\CaptchaAction', | ||
| 52 | + 'fixedVerifyCode' => YII_ENV_TEST ? 'testme' : NULL, | ||
| 53 | + ], | ||
| 54 | + ]; | ||
| 55 | + } | ||
| 90 | 56 | ||
| 91 | - $filters = PortfolioSpecialization::find()->select(["specialization_id","COUNT('specialization_id') AS count"]) | ||
| 92 | - ->where(["portfolio_id"=>$projects ])->groupBy("specialization_id")->all(); | 57 | + public function actionCommon($performer_id) |
| 58 | + { | ||
| 93 | 59 | ||
| 94 | - $portfolio = new ArrayDataProvider([ | ||
| 95 | - 'allModels' => $user->portfolios, | ||
| 96 | - 'pagination' => [ | ||
| 97 | - 'pageSize' => 9, | ||
| 98 | - ], | ||
| 99 | - ]); | 60 | + $user = User::findOne($performer_id); |
| 100 | 61 | ||
| 101 | - return $this->render('portfolio',[ | ||
| 102 | - 'user' => $user, | ||
| 103 | - 'filters' => $filters, | ||
| 104 | - 'portfolio' => $portfolio, | ||
| 105 | - 'count' => count($user->portfolios) | ||
| 106 | - ]); | 62 | + if(!$user instanceof User) { |
| 63 | + throw new BadRequestHttpException('ะะพะปัะทะพะฒะฐัะตะปั ะฝะต ะฝะฐะนะดะตะฝ'); | ||
| 64 | + } | ||
| 107 | 65 | ||
| 108 | - } | 66 | + $educations = Fields::getData($user->id, $user->className(), 'education'); |
| 67 | + $phones = Fields::getData($user->id, $user->className(), 'phone'); | ||
| 68 | + $sites = Fields::getData($user->id, $user->className(), 'site'); | ||
| 69 | + $soft = implode(', ', ArrayHelper::getColumn(Fields::getData($user->id, $user->className(), 'soft'), 'soft')); | ||
| 109 | 70 | ||
| 110 | - public function actionPortfolioFilter($performer_id, $filter){ | ||
| 111 | - $user = User::findOne($performer_id); | 71 | + return $this->render('common', [ |
| 72 | + 'user' => $user, | ||
| 73 | + 'educations' => $educations, | ||
| 74 | + 'phones' => $phones, | ||
| 75 | + 'sites' => $sites, | ||
| 76 | + 'soft' => $soft, | ||
| 77 | + ]); | ||
| 112 | 78 | ||
| 113 | - if(!$user instanceof User){ | ||
| 114 | - throw new BadRequestHttpException('ะะพะปัะทะพะฒะฐัะตะปั ะฝะต ะฝะฐะนะดะตะฝ'); | ||
| 115 | } | 79 | } |
| 116 | - $portfolios = ArrayHelper::getColumn($user->portfolios,'portfolio_id'); | ||
| 117 | - | ||
| 118 | - | ||
| 119 | - $filters = PortfolioSpecialization::find()->select(["specialization_id","COUNT('specialization_id') AS count"]) | ||
| 120 | - ->where(["portfolio_id"=>$portfolios ])->groupBy("specialization_id")->all(); | ||
| 121 | - | ||
| 122 | 80 | ||
| 123 | - $filter_result = PortfolioSpecialization::find() | ||
| 124 | - ->where(['specialization_id'=>$filter, | ||
| 125 | - 'portfolio_id'=>$portfolios | ||
| 126 | - ])->all(); | ||
| 127 | - | ||
| 128 | - | ||
| 129 | - $portfolio = new ArrayDataProvider([ | ||
| 130 | - 'allModels' => Portfolio::find()->where(['portfolio_id'=>ArrayHelper::getColumn($filter_result,'portfolio_id')])->all(), | ||
| 131 | - 'pagination' => [ | ||
| 132 | - 'pageSize' => 9, | ||
| 133 | - ], | ||
| 134 | - ]); | 81 | + public function actionPortfolio($performer_id) |
| 82 | + { | ||
| 83 | + $user = User::findOne($performer_id); | ||
| 135 | 84 | ||
| 136 | - return $this->render('portfolio',[ | ||
| 137 | - 'user' => $user, | ||
| 138 | - 'filters' => $filters, | ||
| 139 | - 'portfolio' => $portfolio, | ||
| 140 | - 'filter_id' => $filter, | ||
| 141 | - 'count' => count($user->portfolios) | ||
| 142 | - ]); | ||
| 143 | - } | 85 | + if(!$user instanceof User) { |
| 86 | + throw new BadRequestHttpException('ะะพะปัะทะพะฒะฐัะตะปั ะฝะต ะฝะฐะนะดะตะฝ'); | ||
| 87 | + } | ||
| 88 | + $projects = ArrayHelper::getColumn($user->portfolios, 'portfolio_id'); | ||
| 89 | + | ||
| 90 | + $filters = PortfolioSpecialization::find() | ||
| 91 | + ->select([ | ||
| 92 | + "specialization_id", | ||
| 93 | + "COUNT('specialization_id') AS count", | ||
| 94 | + ]) | ||
| 95 | + ->where([ "portfolio_id" => $projects ]) | ||
| 96 | + ->groupBy("specialization_id") | ||
| 97 | + ->all(); | ||
| 98 | + | ||
| 99 | + $portfolio = new ArrayDataProvider([ | ||
| 100 | + 'allModels' => $user->portfolios, | ||
| 101 | + 'pagination' => [ | ||
| 102 | + 'pageSize' => 9, | ||
| 103 | + ], | ||
| 104 | + ]); | ||
| 105 | + | ||
| 106 | + return $this->render('portfolio', [ | ||
| 107 | + 'user' => $user, | ||
| 108 | + 'filters' => $filters, | ||
| 109 | + 'portfolio' => $portfolio, | ||
| 110 | + 'count' => count($user->portfolios), | ||
| 111 | + ]); | ||
| 144 | 112 | ||
| 145 | - public function actionPortfolioView($performer_id/*, $portfolio_id*/) | ||
| 146 | - { | ||
| 147 | - $user = User::findOne($performer_id); | ||
| 148 | - return $this->render('portfolio-view', ['user' => $user]); | ||
| 149 | - } | 113 | + } |
| 150 | 114 | ||
| 151 | - public function actionBlogList($performer_id) | ||
| 152 | - { | ||
| 153 | - $user = User::findOne($performer_id); | 115 | + public function actionPortfolioFilter($performer_id, $filter) |
| 116 | + { | ||
| 117 | + $user = User::findOne($performer_id); | ||
| 154 | 118 | ||
| 155 | - if(!$user instanceof User){ | ||
| 156 | - throw new BadRequestHttpException('ะะพะปัะทะพะฒะฐัะตะปั ะฝะต ะฝะฐะนะดะตะฝ'); | 119 | + if(!$user instanceof User) { |
| 120 | + throw new BadRequestHttpException('ะะพะปัะทะพะฒะฐัะตะปั ะฝะต ะฝะฐะนะดะตะฝ'); | ||
| 121 | + } | ||
| 122 | + $portfolios = ArrayHelper::getColumn($user->portfolios, 'portfolio_id'); | ||
| 123 | + | ||
| 124 | + $filters = PortfolioSpecialization::find() | ||
| 125 | + ->select([ | ||
| 126 | + "specialization_id", | ||
| 127 | + "COUNT('specialization_id') AS count", | ||
| 128 | + ]) | ||
| 129 | + ->where([ "portfolio_id" => $portfolios ]) | ||
| 130 | + ->groupBy("specialization_id") | ||
| 131 | + ->all(); | ||
| 132 | + | ||
| 133 | + $filter_result = PortfolioSpecialization::find() | ||
| 134 | + ->where([ | ||
| 135 | + 'specialization_id' => $filter, | ||
| 136 | + 'portfolio_id' => $portfolios, | ||
| 137 | + ]) | ||
| 138 | + ->all(); | ||
| 139 | + | ||
| 140 | + $portfolio = new ArrayDataProvider([ | ||
| 141 | + 'allModels' => Portfolio::find() | ||
| 142 | + ->where([ 'portfolio_id' => ArrayHelper::getColumn($filter_result, 'portfolio_id') ]) | ||
| 143 | + ->all(), | ||
| 144 | + 'pagination' => [ | ||
| 145 | + 'pageSize' => 9, | ||
| 146 | + ], | ||
| 147 | + ]); | ||
| 148 | + | ||
| 149 | + return $this->render('portfolio', [ | ||
| 150 | + 'user' => $user, | ||
| 151 | + 'filters' => $filters, | ||
| 152 | + 'portfolio' => $portfolio, | ||
| 153 | + 'filter_id' => $filter, | ||
| 154 | + 'count' => count($user->portfolios), | ||
| 155 | + ]); | ||
| 157 | } | 156 | } |
| 158 | 157 | ||
| 158 | + public function actionPortfolioView($performer_id, $portfolio_id) | ||
| 159 | + { | ||
| 160 | + $user = User::findOne($performer_id); | ||
| 161 | + $portfolio = $user->getPortfolios() | ||
| 162 | + ->where([ 'portfolio_id' => $portfolio_id ]) | ||
| 163 | + ->one(); | ||
| 164 | + $portfolio->updateCounters([ 'view_count' => 1 ]); | ||
| 165 | + return $this->render('portfolio-view', [ | ||
| 166 | + 'user' => $user, | ||
| 167 | + 'portfolio' => $portfolio, | ||
| 168 | + ]); | ||
| 169 | + } | ||
| 159 | 170 | ||
| 160 | - $query = $user->getBlog(); | ||
| 161 | - | ||
| 162 | - $countQuery = clone $query; | 171 | + public function actionBlogList($performer_id) |
| 172 | + { | ||
| 173 | + $user = User::findOne($performer_id); | ||
| 163 | 174 | ||
| 164 | - $pagination = new Pagination(['totalCount' => $countQuery->count(), | ||
| 165 | - 'pageSize' => 5, | ||
| 166 | - ]); | 175 | + if(!$user instanceof User) { |
| 176 | + throw new BadRequestHttpException('ะะพะปัะทะพะฒะฐัะตะปั ะฝะต ะฝะฐะนะดะตะฝ'); | ||
| 177 | + } | ||
| 167 | 178 | ||
| 168 | - $article = $query->offset($pagination->offset) | ||
| 169 | - ->limit($pagination->limit) | ||
| 170 | - ->all(); | 179 | + $query = $user->getBlog(); |
| 171 | 180 | ||
| 172 | - $blog = new ArrayDataProvider([ | ||
| 173 | - 'allModels' => $article, | ||
| 174 | - ]); | 181 | + $countQuery = clone $query; |
| 175 | 182 | ||
| 183 | + $pagination = new Pagination([ | ||
| 184 | + 'totalCount' => $countQuery->count(), | ||
| 185 | + 'pageSize' => 5, | ||
| 186 | + ]); | ||
| 176 | 187 | ||
| 177 | - return $this->render('blog-list',[ | ||
| 178 | - 'user' => $user, | ||
| 179 | - 'blog' => $blog, | ||
| 180 | - 'pagination' => $pagination | ||
| 181 | - ]); | ||
| 182 | - } | 188 | + $article = $query->offset($pagination->offset) |
| 189 | + ->limit($pagination->limit) | ||
| 190 | + ->all(); | ||
| 183 | 191 | ||
| 184 | - public function actionBlogView($performer_id, $link) | ||
| 185 | - { | ||
| 186 | - $user = User::findOne($performer_id); | 192 | + $blog = new ArrayDataProvider([ |
| 193 | + 'allModels' => $article, | ||
| 194 | + ]); | ||
| 187 | 195 | ||
| 188 | - if(!$user instanceof User){ | ||
| 189 | - throw new BadRequestHttpException('ะะพะปัะทะพะฒะฐัะตะปั ะฝะต ะฝะฐะนะดะตะฝ'); | 196 | + return $this->render('blog-list', [ |
| 197 | + 'user' => $user, | ||
| 198 | + 'blog' => $blog, | ||
| 199 | + 'pagination' => $pagination, | ||
| 200 | + ]); | ||
| 190 | } | 201 | } |
| 191 | 202 | ||
| 203 | + public function actionBlogView($performer_id, $link) | ||
| 204 | + { | ||
| 205 | + $user = User::findOne($performer_id); | ||
| 192 | 206 | ||
| 193 | - $article = Blog::findOne(['link'=>$link,'user_id'=>$performer_id]); | ||
| 194 | - $article->updateCounters(['view_count' => 1]); | ||
| 195 | - | ||
| 196 | - | ||
| 197 | - return $this->render('blog-view',[ | ||
| 198 | - 'user' => $user, | ||
| 199 | - 'article' =>$article, | 207 | + if(!$user instanceof User) { |
| 208 | + throw new BadRequestHttpException('ะะพะปัะทะพะฒะฐัะตะปั ะฝะต ะฝะฐะนะดะตะฝ'); | ||
| 209 | + } | ||
| 200 | 210 | ||
| 201 | - ]); | ||
| 202 | - } | 211 | + $article = Blog::findOne([ |
| 212 | + 'link' => $link, | ||
| 213 | + 'user_id' => $performer_id, | ||
| 214 | + ]); | ||
| 215 | + $article->updateCounters([ 'view_count' => 1 ]); | ||
| 203 | 216 | ||
| 204 | - public function actionReview($performer_id) | ||
| 205 | - { | ||
| 206 | - $user = User::findOne($performer_id); | 217 | + return $this->render('blog-view', [ |
| 218 | + 'user' => $user, | ||
| 219 | + 'article' => $article, | ||
| 207 | 220 | ||
| 208 | - if(!$user instanceof User){ | ||
| 209 | - throw new BadRequestHttpException('ะะพะปัะทะพะฒะฐัะตะปั ะฝะต ะฝะฐะนะดะตะฝ'); | 221 | + ]); |
| 210 | } | 222 | } |
| 211 | 223 | ||
| 224 | + public function actionReview($performer_id) | ||
| 225 | + { | ||
| 226 | + $user = User::findOne($performer_id); | ||
| 212 | 227 | ||
| 213 | - return $this->render('review',[ | ||
| 214 | - 'user' => $user | ||
| 215 | - ]); | ||
| 216 | - } | 228 | + if(!$user instanceof User) { |
| 229 | + throw new BadRequestHttpException('ะะพะปัะทะพะฒะฐัะตะปั ะฝะต ะฝะฐะนะดะตะฝ'); | ||
| 230 | + } | ||
| 217 | 231 | ||
| 218 | - public function actionWorkplace($performer_id) | ||
| 219 | - { | ||
| 220 | - $user = User::findOne($performer_id); | ||
| 221 | - if(!$user instanceof User){ | ||
| 222 | - throw new BadRequestHttpException('ะะพะปัะทะพะฒะฐัะตะปั ะฝะต ะฝะฐะนะดะตะฝ'); | 232 | + return $this->render('review', [ |
| 233 | + 'user' => $user, | ||
| 234 | + ]); | ||
| 223 | } | 235 | } |
| 224 | 236 | ||
| 225 | - return $this->render('workplace',[ | ||
| 226 | - 'user' => $user | ||
| 227 | - ]); | ||
| 228 | - } | ||
| 229 | - | ||
| 230 | - public function actionGallery($performer_id) | ||
| 231 | - { | ||
| 232 | - $user = User::findOne($performer_id); | 237 | + public function actionWorkplace($performer_id) |
| 238 | + { | ||
| 239 | + $user = User::findOne($performer_id); | ||
| 240 | + if(!$user instanceof User) { | ||
| 241 | + throw new BadRequestHttpException('ะะพะปัะทะพะฒะฐัะตะปั ะฝะต ะฝะฐะนะดะตะฝ'); | ||
| 242 | + } | ||
| 233 | 243 | ||
| 234 | - if(!$user instanceof User){ | ||
| 235 | - throw new BadRequestHttpException('ะะพะปัะทะพะฒะฐัะตะปั ะฝะต ะฝะฐะนะดะตะฝ'); | 244 | + return $this->render('workplace', [ |
| 245 | + 'user' => $user, | ||
| 246 | + ]); | ||
| 236 | } | 247 | } |
| 237 | 248 | ||
| 249 | + public function actionGallery($performer_id) | ||
| 250 | + { | ||
| 251 | + $user = User::findOne($performer_id); | ||
| 238 | 252 | ||
| 239 | - $query = Gallery::find(['user_id'=>$performer_id]); | 253 | + if(!$user instanceof User) { |
| 254 | + throw new BadRequestHttpException('ะะพะปัะทะพะฒะฐัะตะปั ะฝะต ะฝะฐะนะดะตะฝ'); | ||
| 255 | + } | ||
| 256 | + | ||
| 257 | + $query = Gallery::find([ 'user_id' => $performer_id ]); | ||
| 240 | 258 | ||
| 241 | - $countQuery = clone $query; | 259 | + $countQuery = clone $query; |
| 242 | 260 | ||
| 243 | - $pagination = new Pagination(['totalCount' => $countQuery->count(), | ||
| 244 | - 'pageSize' => 5, | ||
| 245 | - ]); | 261 | + $pagination = new Pagination([ |
| 262 | + 'totalCount' => $countQuery->count(), | ||
| 263 | + 'pageSize' => 5, | ||
| 264 | + ]); | ||
| 246 | 265 | ||
| 247 | - $gallery = $query->offset($pagination->offset) | ||
| 248 | - ->limit($pagination->limit) | ||
| 249 | - ->all(); | 266 | + $gallery = $query->offset($pagination->offset) |
| 267 | + ->limit($pagination->limit) | ||
| 268 | + ->all(); | ||
| 250 | 269 | ||
| 251 | - $gallery = new ArrayDataProvider([ | ||
| 252 | - 'allModels' => $gallery, | ||
| 253 | - ]); | 270 | + $gallery = new ArrayDataProvider([ |
| 271 | + 'allModels' => $gallery, | ||
| 272 | + ]); | ||
| 254 | 273 | ||
| 255 | - $videos = Fields::getData($user->id,Gallery::className(),'youtube'); | 274 | + $videos = Fields::getData($user->id, Gallery::className(), 'youtube'); |
| 256 | 275 | ||
| 257 | - $this->layout = 'gallery'; | 276 | + $this->layout = 'gallery'; |
| 258 | 277 | ||
| 259 | - return $this->render('gallery',[ | ||
| 260 | - 'user' => $user, | ||
| 261 | - 'gallery' =>$gallery, | ||
| 262 | - 'pagination' => $pagination, | ||
| 263 | - 'videos' => $videos | ||
| 264 | - ]); | 278 | + return $this->render('gallery', [ |
| 279 | + 'user' => $user, | ||
| 280 | + 'gallery' => $gallery, | ||
| 281 | + 'pagination' => $pagination, | ||
| 282 | + 'videos' => $videos, | ||
| 283 | + ]); | ||
| 284 | + } | ||
| 265 | } | 285 | } |
| 266 | -} |
frontend/views/performer/portfolio-view.php
| 1 | <?php | 1 | <?php |
| 2 | 2 | ||
| 3 | -use \yii\helpers\Html; | ||
| 4 | - | ||
| 5 | -/* @var $this yii\web\View | ||
| 6 | - * @var $user common\models\User | ||
| 7 | - */ | ||
| 8 | -$this->params['user'] = $user; | ||
| 9 | - | ||
| 10 | -$this->title = 'My Yii Application'; | 3 | + use common\models\Portfolio; |
| 4 | + use common\models\User; | ||
| 5 | + use yii\web\ViewAction; | ||
| 6 | + | ||
| 7 | + /** | ||
| 8 | + * @var ViewAction $this | ||
| 9 | + * @var User $user | ||
| 10 | + * @var Portfolio $portfolio | ||
| 11 | + */ | ||
| 12 | + $this->params[ 'user' ] = $user; | ||
| 13 | + | ||
| 14 | + $this->title = 'My Yii Application'; | ||
| 11 | ?> | 15 | ?> |
| 12 | 16 | ||
| 13 | <div class="portfolio-new-page-wrapper style"> | 17 | <div class="portfolio-new-page-wrapper style"> |
| 14 | - <div class="new-portfolio-bg style "><img src="/images/portfolio-project/portfolio-img-3.jpg" alt=""/></div> | 18 | + <div class="new-portfolio-bg style "> |
| 19 | + <img src="<?= $portfolio->cover ?>" alt=""/></div> | ||
| 15 | <div class="new-portfolio-icons-rating-wr style"> | 20 | <div class="new-portfolio-icons-rating-wr style"> |
| 16 | <div class="new-portfolio-icons"> | 21 | <div class="new-portfolio-icons"> |
| 17 | <div class="portfolio-project-views-wr"> | 22 | <div class="portfolio-project-views-wr"> |
| 18 | <div class="portfolio-project-views ico-views-bl"> | 23 | <div class="portfolio-project-views ico-views-bl"> |
| 19 | <div class="portfolio-project-views-img-wr"> | 24 | <div class="portfolio-project-views-img-wr"> |
| 20 | - <div class="portfolio-project-views-img"><img src="/images/portfolio-project/ico-1.png"></div> | 25 | + <div class="portfolio-project-views-img"> |
| 26 | + <img src="/images/portfolio-project/ico-1.png"></div> | ||
| 21 | </div> | 27 | </div> |
| 22 | - <div class="portfolio-project-views-txt">127</div> | 28 | + <div class="portfolio-project-views-txt"><?= $portfolio->view_count ?></div> |
| 23 | </div> | 29 | </div> |
| 24 | <div class="portfolio-project-rati ico-views-bl"> | 30 | <div class="portfolio-project-rati ico-views-bl"> |
| 25 | <div class="portfolio-project-views-img-wr"> | 31 | <div class="portfolio-project-views-img-wr"> |
| 26 | - <div class="portfolio-project-views-img"><img src="/images/portfolio-project/ico-2.png"></div> | 32 | + <div class="portfolio-project-views-img"> |
| 33 | + <img src="/images/portfolio-project/ico-2.png"></div> | ||
| 27 | </div> | 34 | </div> |
| 28 | - <div class="portfolio-project-views-txt">10.0</div> | 35 | + <div class="portfolio-project-views-txt">XX.X</div> |
| 29 | </div> | 36 | </div> |
| 30 | <div class="ico-views-bl"> | 37 | <div class="ico-views-bl"> |
| 31 | <div class="portfolio-project-views-img-wr"> | 38 | <div class="portfolio-project-views-img-wr"> |
| 32 | - <div class="portfolio-project-views-img"><img src="/images/portfolio-project/ico-3.png"></div> | 39 | + <div class="portfolio-project-views-img"> |
| 40 | + <img src="/images/portfolio-project/ico-3.png"></div> | ||
| 33 | </div> | 41 | </div> |
| 34 | - <div class="portfolio-project-views-txt">14</div> | 42 | + <div class="portfolio-project-views-txt">XX</div> |
| 35 | </div> | 43 | </div> |
| 36 | </div> | 44 | </div> |
| 37 | </div> | 45 | </div> |
| @@ -46,25 +54,32 @@ $this->title = 'My Yii Application'; | @@ -46,25 +54,32 @@ $this->title = 'My Yii Application'; | ||
| 46 | </div> | 54 | </div> |
| 47 | 55 | ||
| 48 | <div class="new-portf-slider-wr style"> | 56 | <div class="new-portf-slider-wr style"> |
| 49 | - <div class="new-portf-slider-title">ะะฒะฐััะธัะฐ - ัััะดะธั ะฒ ัะพะฒัะตะผะตะฝะฝะพะผ ััะธะปะต</div> | ||
| 50 | - <div class="new-portf-slider style"> | ||
| 51 | - <div class="slider-video-wr"> | ||
| 52 | - <div id="demo5" class="scroll-img"> | ||
| 53 | - <ul> | ||
| 54 | - <li><img src="/images/portfolio-project/slider-img-1.jpg" alt=""/></li> | ||
| 55 | - <li><img src="/images/portfolio-project/slider-img-2.jpg" alt=""/></li> | ||
| 56 | - <li><img src="/images/portfolio-project/slider-img-3.jpg" alt=""/></li> | ||
| 57 | - <li><img src="/images/portfolio-project/slider-img-1.jpg" alt=""/></li> | ||
| 58 | - <li><img src="/images/portfolio-project/slider-img-2.jpg" alt=""/></li> | ||
| 59 | - <li><img src="/images/portfolio-project/slider-img-3.jpg" alt=""/></li> | ||
| 60 | - </ul> | ||
| 61 | - </div> | ||
| 62 | - <div id="demo5-btn" class="text-center"> | ||
| 63 | - <button class="btn" id="demo5-backward"></button> | ||
| 64 | - <button class="btn" id="demo5-forward"></button> | 57 | + <div class="new-portf-slider-title"><?= $portfolio->name ?></div> |
| 58 | + <?php | ||
| 59 | + if(!empty( $portfolio->gallery ) || !empty( $portfolio->gallery->photo )) { | ||
| 60 | + ?> | ||
| 61 | + <div class="new-portf-slider style"> | ||
| 62 | + <div class="slider-video-wr"> | ||
| 63 | + <div id="demo5" class="scroll-img"> | ||
| 64 | + <ul> | ||
| 65 | + <?php | ||
| 66 | + foreach(explode(',', $portfolio->gallery->photo) as $one_photo) { | ||
| 67 | + ?> | ||
| 68 | + <li><img src="<?= $one_photo ?>" alt=""/> | ||
| 69 | + <?php | ||
| 70 | + } | ||
| 71 | + ?> | ||
| 72 | + </ul> | ||
| 73 | + </div> | ||
| 74 | + <div id="demo5-btn" class="text-center"> | ||
| 75 | + <button class="btn" id="demo5-backward"></button> | ||
| 76 | + <button class="btn" id="demo5-forward"></button> | ||
| 77 | + </div> | ||
| 78 | + </div> | ||
| 65 | </div> | 79 | </div> |
| 66 | - </div> | ||
| 67 | - </div> | 80 | + <?php |
| 81 | + } | ||
| 82 | + ?> | ||
| 68 | </div> | 83 | </div> |
| 69 | 84 | ||
| 70 | <div class="new-portfolio-txt-wrapper style"> | 85 | <div class="new-portfolio-txt-wrapper style"> |
| @@ -167,7 +182,8 @@ $this->title = 'My Yii Application'; | @@ -167,7 +182,8 @@ $this->title = 'My Yii Application'; | ||
| 167 | </div> | 182 | </div> |
| 168 | </div> | 183 | </div> |
| 169 | <div class="blog-post-date"> | 184 | <div class="blog-post-date"> |
| 170 | - <span></span><p>22.09.2015</p> | 185 | + <span></span> |
| 186 | + <p>22.09.2015</p> | ||
| 171 | </div> | 187 | </div> |
| 172 | </div> | 188 | </div> |
| 173 | 189 | ||
| @@ -196,7 +212,8 @@ $this->title = 'My Yii Application'; | @@ -196,7 +212,8 @@ $this->title = 'My Yii Application'; | ||
| 196 | </div> | 212 | </div> |
| 197 | </div> | 213 | </div> |
| 198 | <div class="blog-post-date"> | 214 | <div class="blog-post-date"> |
| 199 | - <span></span><p>22.09.2015</p> | 215 | + <span></span> |
| 216 | + <p>22.09.2015</p> | ||
| 200 | </div> | 217 | </div> |
| 201 | </div> | 218 | </div> |
| 202 | 219 | ||
| @@ -225,7 +242,8 @@ $this->title = 'My Yii Application'; | @@ -225,7 +242,8 @@ $this->title = 'My Yii Application'; | ||
| 225 | </div> | 242 | </div> |
| 226 | </div> | 243 | </div> |
| 227 | <div class="blog-post-date"> | 244 | <div class="blog-post-date"> |
| 228 | - <span></span><p>22.09.2015</p> | 245 | + <span></span> |
| 246 | + <p>22.09.2015</p> | ||
| 229 | </div> | 247 | </div> |
| 230 | </div> | 248 | </div> |
| 231 | 249 | ||
| @@ -254,7 +272,8 @@ $this->title = 'My Yii Application'; | @@ -254,7 +272,8 @@ $this->title = 'My Yii Application'; | ||
| 254 | </div> | 272 | </div> |
| 255 | </div> | 273 | </div> |
| 256 | <div class="blog-post-date"> | 274 | <div class="blog-post-date"> |
| 257 | - <span></span><p>22.09.2015</p> | 275 | + <span></span> |
| 276 | + <p>22.09.2015</p> | ||
| 258 | </div> | 277 | </div> |
| 259 | </div> | 278 | </div> |
| 260 | 279 | ||
| @@ -282,7 +301,8 @@ $this->title = 'My Yii Application'; | @@ -282,7 +301,8 @@ $this->title = 'My Yii Application'; | ||
| 282 | </div> | 301 | </div> |
| 283 | </div> | 302 | </div> |
| 284 | <div class="blog-post-date"> | 303 | <div class="blog-post-date"> |
| 285 | - <span></span><p>22.09.2015</p> | 304 | + <span></span> |
| 305 | + <p>22.09.2015</p> | ||
| 286 | </div> | 306 | </div> |
| 287 | </div> | 307 | </div> |
| 288 | 308 | ||
| @@ -299,40 +319,58 @@ $this->title = 'My Yii Application'; | @@ -299,40 +319,58 @@ $this->title = 'My Yii Application'; | ||
| 299 | </div> | 319 | </div> |
| 300 | </div> | 320 | </div> |
| 301 | <script> | 321 | <script> |
| 302 | - $('.portfolio-new-page-wrapper .rating').rating({ | ||
| 303 | - fx: 'full', | ||
| 304 | - readOnly: false, | ||
| 305 | - url: 'rating.php' | ||
| 306 | - }); | 322 | + $('.portfolio-new-page-wrapper .rating').rating( |
| 323 | + { | ||
| 324 | + fx : 'full', readOnly : false, url : 'rating.php' | ||
| 325 | + } | ||
| 326 | + ); | ||
| 307 | </script> | 327 | </script> |
| 308 | <script> | 328 | <script> |
| 309 | - $(document).ready(function(){ | ||
| 310 | - portfolioHideTxt() | ||
| 311 | - function portfolioHideTxt(){ | ||
| 312 | - $('.new-portfolio-excerpt .new-portfolio-see-all span').click(function(){ | ||
| 313 | - $(this).parent().parent().parent().toggleClass('show-all') | ||
| 314 | - }) | ||
| 315 | - $('.new-portfolio-txt .new-portfolio-see-all span').click(function(){ | ||
| 316 | - $(this).parent().parent().parent().toggleClass('show-all') | ||
| 317 | - }) | 329 | + $(document).ready( |
| 330 | + function() | ||
| 331 | + { | ||
| 332 | + portfolioHideTxt() | ||
| 333 | + function portfolioHideTxt() | ||
| 334 | + { | ||
| 335 | + $('.new-portfolio-excerpt .new-portfolio-see-all span').click( | ||
| 336 | + function() | ||
| 337 | + { | ||
| 338 | + $(this).parent().parent().parent().toggleClass('show-all') | ||
| 339 | + } | ||
| 340 | + ) | ||
| 341 | + $('.new-portfolio-txt .new-portfolio-see-all span').click( | ||
| 342 | + function() | ||
| 343 | + { | ||
| 344 | + $(this).parent().parent().parent().toggleClass('show-all') | ||
| 345 | + } | ||
| 346 | + ) | ||
| 347 | + } | ||
| 318 | } | 348 | } |
| 319 | - }) | 349 | + ) |
| 320 | </script> | 350 | </script> |
| 321 | <script> | 351 | <script> |
| 322 | - $(function () { | ||
| 323 | - $('.new-portf-slider #demo5').scrollbox({ | ||
| 324 | - direction: 'h', | ||
| 325 | - distance: 230, | ||
| 326 | - autoPlay: false, | ||
| 327 | - onMouseOverPause: false | ||
| 328 | - }); | ||
| 329 | - $('#demo5-backward').click(function () { | ||
| 330 | - $('#demo5').trigger('backward'); | ||
| 331 | - }); | ||
| 332 | - $('#demo5-forward').click(function () { | ||
| 333 | - $('#demo5').trigger('forward'); | ||
| 334 | - }); | ||
| 335 | - var widthSlider = $('.new-portf-slider ul li').length | ||
| 336 | - $('.new-portf-slider ul').css({width:((widthSlider*230)-30)}) | ||
| 337 | - }); | 352 | + $( |
| 353 | + function() | ||
| 354 | + { | ||
| 355 | + $('.new-portf-slider #demo5').scrollbox( | ||
| 356 | + { | ||
| 357 | + direction : 'h', distance : 230, autoPlay : false, onMouseOverPause : false | ||
| 358 | + } | ||
| 359 | + ); | ||
| 360 | + $('#demo5-backward').click( | ||
| 361 | + function() | ||
| 362 | + { | ||
| 363 | + $('#demo5').trigger('backward'); | ||
| 364 | + } | ||
| 365 | + ); | ||
| 366 | + $('#demo5-forward').click( | ||
| 367 | + function() | ||
| 368 | + { | ||
| 369 | + $('#demo5').trigger('forward'); | ||
| 370 | + } | ||
| 371 | + ); | ||
| 372 | + var widthSlider = $('.new-portf-slider ul li').length | ||
| 373 | + $('.new-portf-slider ul').css({width : ((widthSlider * 230) - 30)}) | ||
| 374 | + } | ||
| 375 | + ); | ||
| 338 | </script> | 376 | </script> |
| 339 | \ No newline at end of file | 377 | \ No newline at end of file |