Commit ec0ad167d62e3d8ef6ecab274b14066e41ebbc12

Authored by alex
1 parent faf242dc

Поменял логику работы виджета Parthenr

common/models/Partner.php
... ... @@ -3,6 +3,7 @@
3 3 namespace common\models;
4 4  
5 5 use Yii;
  6 +use artbox\core\components\imagemanager\models\ImageManager;
6 7  
7 8 /**
8 9 * This is the model class for table "partner".
... ... @@ -49,4 +50,13 @@ class Partner extends \yii\db\ActiveRecord
49 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
... ... @@ -15,7 +15,7 @@
15 15 */
16 16 $seo = \Yii::$app->get('seo');
17 17  
18   - $this->params[ 'breadcrumbs' ][] = \Yii::t('app', 'Blog');
  18 + $this->params[ 'breadcrumbs' ][] = \Yii::t('app', 'News');
19 19  
20 20 ?>
21 21  
... ...
frontend/views/site/about.php
... ... @@ -9,7 +9,7 @@
9 9 * @var SeoComponent $seo
10 10 */
11 11 $seo = \Yii::$app->get('seo');
12   - $this->params[ 'breadcrumbs' ][] = $seo->title;
  12 + $this->params[ 'breadcrumbs' ][] = \Yii::t('app','About');
13 13 ?>
14 14 <div id="content">
15 15 <div class="container">
... ...
frontend/web/js/script.js
1 1 $(
2 2 function() {
3   - phoneMask('input[name="Feedback[phone]"]');
  3 + // phoneMask('input[name="Feedback[phone]"]');
4 4 // /**
5 5 // * Modal form submit code
6 6 // */
... ... @@ -12,7 +12,7 @@ $(
12 12 // var formData = form.serialize();
13 13 // $.ajax(
14 14 // {
15   - // url: form.attr("action"),
  15 + // url: form.attr("action"),
16 16 // type: form.attr("method"),
17 17 // data: formData,
18 18 // success: function(data) {
... ...
frontend/widgets/ParthnersList.php
... ... @@ -4,7 +4,7 @@
4 4  
5 5 namespace frontend\widgets;
6 6 use yii\base\Widget;
7   -
  7 +use common\models\Partner;
8 8  
9 9  
10 10 class ParthnersList extends Widget
... ... @@ -15,20 +15,11 @@ class ParthnersList extends Widget
15 15 {
16 16 parent::init();
17 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 2 /**
3 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 12 <ul class="owl-carousel customers" >
  13 + <?php ?>
8 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 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 24 </li>
12 25 <?php endforeach;?>
13 26 </ul>
14 27 \ No newline at end of file
... ...