Commit ec0ad167d62e3d8ef6ecab274b14066e41ebbc12
1 parent
faf242dc
Поменял логику работы виджета Parthenr
Showing
6 changed files
with
33 additions
and
19 deletions
Show diff stats
common/models/Partner.php
@@ -3,6 +3,7 @@ | @@ -3,6 +3,7 @@ | ||
3 | namespace common\models; | 3 | namespace common\models; |
4 | 4 | ||
5 | use Yii; | 5 | use Yii; |
6 | +use artbox\core\components\imagemanager\models\ImageManager; | ||
6 | 7 | ||
7 | /** | 8 | /** |
8 | * This is the model class for table "partner". | 9 | * This is the model class for table "partner". |
@@ -49,4 +50,13 @@ class Partner extends \yii\db\ActiveRecord | @@ -49,4 +50,13 @@ class Partner extends \yii\db\ActiveRecord | ||
49 | 'link' => Yii::t('app', 'Link'), | 50 | 'link' => Yii::t('app', 'Link'), |
50 | ]; | 51 | ]; |
51 | } | 52 | } |
53 | + | ||
54 | + | ||
55 | + public function getImage() | ||
56 | + { | ||
57 | + return $this->hasOne(ImageManager::className(),['id'=>'image_id']); | ||
58 | + } | ||
59 | + | ||
60 | + | ||
61 | + | ||
52 | } | 62 | } |
frontend/views/blog/index.php
frontend/views/site/about.php
@@ -9,7 +9,7 @@ | @@ -9,7 +9,7 @@ | ||
9 | * @var SeoComponent $seo | 9 | * @var SeoComponent $seo |
10 | */ | 10 | */ |
11 | $seo = \Yii::$app->get('seo'); | 11 | $seo = \Yii::$app->get('seo'); |
12 | - $this->params[ 'breadcrumbs' ][] = $seo->title; | 12 | + $this->params[ 'breadcrumbs' ][] = \Yii::t('app','About'); |
13 | ?> | 13 | ?> |
14 | <div id="content"> | 14 | <div id="content"> |
15 | <div class="container"> | 15 | <div class="container"> |
frontend/web/js/script.js
1 | $( | 1 | $( |
2 | function() { | 2 | function() { |
3 | - phoneMask('input[name="Feedback[phone]"]'); | 3 | + // phoneMask('input[name="Feedback[phone]"]'); |
4 | // /** | 4 | // /** |
5 | // * Modal form submit code | 5 | // * Modal form submit code |
6 | // */ | 6 | // */ |
@@ -12,7 +12,7 @@ $( | @@ -12,7 +12,7 @@ $( | ||
12 | // var formData = form.serialize(); | 12 | // var formData = form.serialize(); |
13 | // $.ajax( | 13 | // $.ajax( |
14 | // { | 14 | // { |
15 | - // url: form.attr("action"), | 15 | + // url: form.attr("action"), |
16 | // type: form.attr("method"), | 16 | // type: form.attr("method"), |
17 | // data: formData, | 17 | // data: formData, |
18 | // success: function(data) { | 18 | // success: function(data) { |
frontend/widgets/ParthnersList.php
@@ -4,7 +4,7 @@ | @@ -4,7 +4,7 @@ | ||
4 | 4 | ||
5 | namespace frontend\widgets; | 5 | namespace frontend\widgets; |
6 | use yii\base\Widget; | 6 | use yii\base\Widget; |
7 | - | 7 | +use common\models\Partner; |
8 | 8 | ||
9 | 9 | ||
10 | class ParthnersList extends Widget | 10 | class ParthnersList extends Widget |
@@ -15,20 +15,11 @@ class ParthnersList extends Widget | @@ -15,20 +15,11 @@ class ParthnersList extends Widget | ||
15 | { | 15 | { |
16 | parent::init(); | 16 | parent::init(); |
17 | #$this->filesList=preg_grep('$^customer-\d{1,3}\.(png|jpg|jpeg)$',scandir('../web/img',0)); | 17 | #$this->filesList=preg_grep('$^customer-\d{1,3}\.(png|jpg|jpeg)$',scandir('../web/img',0)); |
18 | + $this->filesList=Partner::find() | ||
19 | + ->where(['status'=>true]) | ||
20 | + ->all(); | ||
21 | + | ||
18 | 22 | ||
19 | - $this->filesList=[ | ||
20 | - ['http://www.uspp.ua','customer-1.png'], | ||
21 | - ['http://kiev-chamber.org.ua','customer-2.jpg'], | ||
22 | - ['http://www.traidenis.lt','customer-3.jpg'], | ||
23 | - ['http://www.bod.lt','customer-4.png' ], | ||
24 | - #['www.health.gov.ua','customer-5.jpeg'], | ||
25 | - #['http://www.medved.kiev.ua ','customer-6.jpeg'], | ||
26 | - ['http://www.unhpa.com.ua ','customer-7.png'], | ||
27 | - ['https://ukrvodokanal.in.ua ','customer-8.png',], | ||
28 | - ['http://soyuz-corp.com.ua ','customer-9.jpg',], | ||
29 | - ['http://www.ltava.com.ua ','customer-10.png',], | ||
30 | - ['http://ittf.kiev.ua ','customer-11.png'], | ||
31 | - ]; | ||
32 | } | 23 | } |
33 | 24 | ||
34 | 25 |
frontend/widgets/views/_parthnerList.php
@@ -2,12 +2,25 @@ | @@ -2,12 +2,25 @@ | ||
2 | /** | 2 | /** |
3 | * @var $data frontend\widgets\ParthnersList | 3 | * @var $data frontend\widgets\ParthnersList |
4 | */ | 4 | */ |
5 | + | ||
6 | +use artbox\core\components\imagemanager\models\ImageManager; | ||
7 | + | ||
8 | + | ||
9 | + | ||
5 | ?> | 10 | ?> |
6 | 11 | ||
7 | <ul class="owl-carousel customers" > | 12 | <ul class="owl-carousel customers" > |
13 | + <?php ?> | ||
8 | <?php foreach ($data as $parthner):?> | 14 | <?php foreach ($data as $parthner):?> |
15 | + <?php | ||
16 | + $filePath=(file_exists('../../web/img/'.$parthner->image->fileName)) | ||
17 | + ?'/img/'.$parthner->image->fileName:'/img/no-image.png'; | ||
18 | + ?> | ||
19 | + | ||
20 | + | ||
21 | + | ||
9 | <li class="item"> | 22 | <li class="item"> |
10 | - <a target="_blank" href="<?=$parthner[0];?>"><img src="/img/<?=$parthner[1];?>" alt="" class="img-responsive"></a> | 23 | + <a target="_blank" href="<?=$parthner->link;?>"><img src="<?=$filePath;?>" alt="" class="img-responsive"></a> |
11 | </li> | 24 | </li> |
12 | <?php endforeach;?> | 25 | <?php endforeach;?> |
13 | </ul> | 26 | </ul> |
14 | \ No newline at end of file | 27 | \ No newline at end of file |