Blame view

frontend/modules/partners/widgets/Partners.php 1.31 KB
d1f8bd40   Alexey Boroda   first commit
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
  <?php
  
  namespace frontend\modules\partners\widgets;
  
  use yii\helpers\Html;
  //
  use thread\app\base\widgets\Widget;
  //
  use frontend\modules\partners\models\Item as MainModel;
  use frontend\modules\partners\Partners as MainModule;
  
  /**
   * Class Partners
   *
   * @package frontend\modules\partners\widgets
   * @author Alla Kuzmenko
   * @copyright (c), Thread
   */
  class Partners extends Widget
  {
  
      /**
       * @var null
       */
      protected $items = null;
  
      /**
       *
       */
      public function init()
      {
          $this->items = MainModel::findList();
      }
  
      /**
       *
       */
      public function run()
      {
          if ($this->items !== null) {
              $result = '';
              foreach ($this->items as $item) {
                  $result .= Html::beginTag('div', ['class' => 'col-sm-2'])
                      . Html::a(Html::img(MainModule::getImageLinkForItem($item['image_link']), [
                          'class' => 'img-responsive',
                          'alt' => Html::decode($item['lang']['title'])
                      ]), $item['site_link'], ['class' => 'footer-logo'])
                      //. Html::tag('div', Html::decode($item['lang']['title']), ['class' => 'footer-sm-text'])
                      . Html::endTag('div');
              }
              return $result;
          } else {
              return false;
          }
      }
  }