Commit 34e7b1a43339f785f22e501404fd5b03dcee02cb
1 parent
fd7caf21
15.02.16
Showing
5 changed files
with
30 additions
and
9 deletions
Show diff stats
common/behaviors/ShowImage.php
@@ -27,5 +27,17 @@ class ShowImage extends Behavior | @@ -27,5 +27,17 @@ class ShowImage extends Behavior | ||
27 | 27 | ||
28 | } | 28 | } |
29 | 29 | ||
30 | + function ShowGallery($array){ | ||
31 | + | ||
32 | + $gallery = explode(',', $array ); | ||
33 | + if(is_array($gallery)){ | ||
34 | + array_splice($gallery,-1); | ||
35 | + return $gallery; | ||
36 | + } else { | ||
37 | + return []; | ||
38 | + } | ||
39 | + | ||
40 | + } | ||
41 | + | ||
30 | 42 | ||
31 | } | 43 | } |
32 | \ No newline at end of file | 44 | \ No newline at end of file |
frontend/controllers/AccountsController.php
@@ -365,7 +365,7 @@ | @@ -365,7 +365,7 @@ | ||
365 | public function actionPortfolioCreate() | 365 | public function actionPortfolioCreate() |
366 | { | 366 | { |
367 | $portfolio = new Portfolio(); | 367 | $portfolio = new Portfolio(); |
368 | - $specializations = Specialization::find()->orderBy('specialization_id')->all(); | 368 | + $specializations = Specialization::find()->where(['specialization_pid' => 0])->orderBy('specialization_id')->all(); |
369 | $post = \Yii::$app->request->post(); | 369 | $post = \Yii::$app->request->post(); |
370 | if(!empty( $post )) { | 370 | if(!empty( $post )) { |
371 | $portfolio->load($post); | 371 | $portfolio->load($post); |
@@ -374,7 +374,10 @@ | @@ -374,7 +374,10 @@ | ||
374 | $portfolio->save(); | 374 | $portfolio->save(); |
375 | $portfolio->unlinkAll('specializations', true); | 375 | $portfolio->unlinkAll('specializations', true); |
376 | foreach($portfolio->specializationInput as $one_specialization) { | 376 | foreach($portfolio->specializationInput as $one_specialization) { |
377 | - $portfolio->link('specializations', Specialization::findOne($one_specialization)); | 377 | + if($one_specialization){ |
378 | + | ||
379 | + $portfolio->link('specializations', Specialization::findOne($one_specialization)); | ||
380 | + } | ||
378 | } | 381 | } |
379 | return $this->redirect('portfolio'); | 382 | return $this->redirect('portfolio'); |
380 | } | 383 | } |
@@ -388,7 +391,7 @@ | @@ -388,7 +391,7 @@ | ||
388 | public function actionPortfolioUpdate($id) | 391 | public function actionPortfolioUpdate($id) |
389 | { | 392 | { |
390 | $portfolio = Portfolio::findOne($id); | 393 | $portfolio = Portfolio::findOne($id); |
391 | - $specializations = Specialization::find()->orderBy('specialization_id')->all(); | 394 | + $specializations = Specialization::find()->where(['specialization_pid' => 0])->orderBy('specialization_id')->all(); |
392 | $post = \Yii::$app->request->post(); | 395 | $post = \Yii::$app->request->post(); |
393 | if(!empty( $post )) { | 396 | if(!empty( $post )) { |
394 | $portfolio->load($post); | 397 | $portfolio->load($post); |
@@ -396,8 +399,11 @@ | @@ -396,8 +399,11 @@ | ||
396 | if(!$portfolio->hasErrors()) { | 399 | if(!$portfolio->hasErrors()) { |
397 | $portfolio->save(); | 400 | $portfolio->save(); |
398 | $portfolio->unlinkAll('specializations', true); | 401 | $portfolio->unlinkAll('specializations', true); |
402 | + | ||
399 | foreach($portfolio->specializationInput as $one_specialization) { | 403 | foreach($portfolio->specializationInput as $one_specialization) { |
400 | - $portfolio->link('specializations', Specialization::findOne($one_specialization)); | 404 | + if($one_specialization){ |
405 | + $portfolio->link('specializations', Specialization::findOne($one_specialization)); | ||
406 | + } | ||
401 | } | 407 | } |
402 | return $this->redirect('portfolio'); | 408 | return $this->redirect('portfolio'); |
403 | } | 409 | } |
frontend/views/accounts/_portfolio_form.php
@@ -56,7 +56,7 @@ use yii\web\JsExpression; | @@ -56,7 +56,7 @@ use yii\web\JsExpression; | ||
56 | <ul> | 56 | <ul> |
57 | <?php foreach($child_first->children as $child_second):?> | 57 | <?php foreach($child_first->children as $child_second):?> |
58 | <?php if($child_first instanceof Specialization): ?> | 58 | <?php if($child_first instanceof Specialization): ?> |
59 | - <li><a href="#"><?= $child_second->specialization_name?></a></li> | 59 | + <li><a href="#"><?= $form->field($portfolio, 'specializationInput[]')->checkbox(['value' => $child_second->specialization_id, 'label' =>$child_second->specialization_name])?></a></li> |
60 | <?php endif;?> | 60 | <?php endif;?> |
61 | <?php endforeach; ?> | 61 | <?php endforeach; ?> |
62 | </ul> | 62 | </ul> |
frontend/views/layouts/gallery.php
1 | <?php | 1 | <?php |
2 | 2 | ||
3 | +use yii\helpers\Html; | ||
3 | use yii\widgets\Breadcrumbs; | 4 | use yii\widgets\Breadcrumbs; |
4 | use yii\widgets\Menu; | 5 | use yii\widgets\Menu; |
5 | 6 | ||
6 | -\frontend\assets\AdminAsset::register($this); | 7 | +\frontend\assets\AppAsset::register($this); |
7 | /* @var $content string */ | 8 | /* @var $content string */ |
8 | $this->beginContent('@app/views/layouts/main.php'); | 9 | $this->beginContent('@app/views/layouts/main.php'); |
9 | ?> | 10 | ?> |
10 | <div class="section-box content"> | 11 | <div class="section-box content"> |
11 | - <div class="section-box-16" style="background: url('/images/blog/box-16.jpg') no-repeat"> | 12 | + <div class="section-box-16" style="background: url('<?= $this->params['user']->userInfo->poster;?>') 50% no-repeat"> |
12 | <div class="box-wr"> | 13 | <div class="box-wr"> |
13 | <div class="box-all"> | 14 | <div class="box-all"> |
14 | <div class="blog-buttons-wr style"> | 15 | <div class="blog-buttons-wr style"> |
@@ -90,7 +91,9 @@ $this->beginContent('@app/views/layouts/main.php'); | @@ -90,7 +91,9 @@ $this->beginContent('@app/views/layouts/main.php'); | ||
90 | <div class="performance-vacancy-sidebar-comm style">30 отзывов</div> | 91 | <div class="performance-vacancy-sidebar-comm style">30 отзывов</div> |
91 | <a href="#" class="performance-vacancy-sidebar-write style">написать отзыв</a> | 92 | <a href="#" class="performance-vacancy-sidebar-write style">написать отзыв</a> |
92 | </div> | 93 | </div> |
93 | - <div class="performer-vacancy-sidebar-img style"><img src="/images/ded-foto.jpg" alt=""/></div> | 94 | + <div class="performer-vacancy-sidebar-img style"> |
95 | + <?= Html::img($this->params['user']->userInfo->image);?> | ||
96 | + </div> | ||
94 | </div> | 97 | </div> |
95 | </div> | 98 | </div> |
96 | </div> | 99 | </div> |
frontend/views/performer/_gallery_list_view.php
@@ -5,7 +5,7 @@ | @@ -5,7 +5,7 @@ | ||
5 | <a href="#" class="gallery-box-min"><?= Html::img($model->cover)?></a> | 5 | <a href="#" class="gallery-box-min"><?= Html::img($model->cover)?></a> |
6 | <div class="gallery-box-hidden"> | 6 | <div class="gallery-box-hidden"> |
7 | <div class="gallery-box-preview"> | 7 | <div class="gallery-box-preview"> |
8 | - <?php foreach(explode(',', $model->photo ) as $image):?> | 8 | + <?php foreach($model->ShowGallery($model->photo ) as $image):?> |
9 | <span data-link="<?= $image ?>"></span> | 9 | <span data-link="<?= $image ?>"></span> |
10 | <?php endforeach; ?> | 10 | <?php endforeach; ?> |
11 | 11 |