index.php 11.9 KB
<?php
    use artbox\catalog\models\Brand;
    use artbox\catalog\models\Category;
    use artbox\catalog\models\Product;
    use artbox\core\components\SeoComponent;
    use artbox\core\helpers\ImageHelper;
    use artbox\weblog\models\Article;
    use yii\bootstrap\Html;
    use yii\helpers\Url;
    use yii\web\View;
    
    /**
     * @var View         $this
     * @var Category[]   $categories
     * @var Product[]    $topItems
     * @var Product[]    $newItems
     * @var Product[]    $saleItems
     * @var int          $brandCount
     * @var int          $productCount
     * @var Brand[]      $brands
     * @var SeoComponent $seo
     * @var Article[]    $articles
     */
    $this->title = 'My Yii Application';
    $seo = Yii::$app->get('seo');
?>
<section class="category-carousel-box">
  <!-- *** HOMEPAGE CAROUSEL ***
_________________________________________________________ -->
  <div class="container">
    
    <div class="row">
      <div class="hidden-xs hidden-sm col-md-3">
          <!-- если нет вложенности в меню то добавлять родительським li класс ".no-child-menu" -->
          <?php
              echo $this->render(
                  '@frontend/views/layouts/_category_menu',
                  [
                      'isHome' => true,
                  ]
              );
          ?>
      </div>
      
      <div class="col-xs-12 col-sm-12 col-md-9">
        <div class="home-carousel" style="min-height:384px;">
          
          <div class="dark-mask"></div>
          
          <div class="homepage owl-carousel main_slider sliders_">
            <div class="item">
                <a href="#"><img src="../img/market_banner.png" alt=""></a>
            </div>
            <div class="item">
                <a href="#"><img src="../img/market_banner.png" alt=""></a>
            </div>
            <div class="item">
                <a href="#"><img src="../img/market_banner.png" alt=""></a>
            </div>
          </div>
          <!-- /.project owl-slider -->
        </div>
      </div>
    </div>
  </div>
  <!-- *** HOMEPAGE CAROUSEL END *** -->
</section>


<section>
  <div class="container">
<!--      <div class="hidden-xs hidden-sm col-md-3"></div>-->
      <div class="col-xs-12 col-sm-12 col-md-12">
          <?php
          if (!empty($newItems)) {
              ?>
              <div class="heading text-center">
                  <h2><?php echo \Yii::t('app', 'Новинки'); ?></h2>
              </div>

              <div class="product-carousel">
                  <div class="homepage owl-carousel">
                      <?php
                      $newItemsArrays = array_chunk($newItems, 4);
                      foreach ($newItemsArrays as $newItemsArray) {
                          ?>
                          <div class="products">
                              <?php
                              foreach ($newItemsArray as $product) {
                                  echo $this->render(
                                      '_slider_product',
                                      [
                                          'product' => $product,
                                      ]
                                  );
                              }
                              ?>
                          </div>
                          <?php
                      }
                      ?>
                  </div>
              </div>
              <?php
          }
          if (!empty($saleItems)) {
              ?>
              <div class="heading text-center">
                  <h2><?php echo \Yii::t('app', 'Акции'); ?></h2>
              </div>
              <div class="product-carousel">
                  <div class="homepage owl-carousel">
                      <?php
                      $newItemsArrays = array_chunk($saleItems, 4);
                      foreach ($newItemsArrays as $newItemsArray) {
                          ?>
                          <div class="products">
                              <?php
                              foreach ($newItemsArray as $product) {
                                  echo $this->render(
                                      '_slider_product',
                                      [
                                          'product' => $product,
                                      ]
                                  );
                              }
                              ?>
                          </div>
                          <?php
                      }
                      ?>
                  </div>
              </div>
              <?php
          }
          if (!empty($topItems)) {
              ?>
              <div class="heading text-center">
                  <h2><?php echo \Yii::t('app', 'Топ'); ?></h2>
              </div>
              <div class="product-carousel">
                  <div class="homepage owl-carousel">
                      <?php
                      $newItemsArrays = array_chunk($topItems, 4);
                      foreach ($newItemsArrays as $newItemsArray) {
                          ?>
                          <div class="products">
                              <?php
                              foreach ($newItemsArray as $product) {
                                  echo $this->render(
                                      '_slider_product',
                                      [
                                          'product' => $product,
                                      ]
                                  );
                              }
                              ?>
                          </div>
                          <?php
                      }
                      ?>
                  </div>
              </div>
              <?php
          }
          ?>
      </div>
  </div>
</section>

<section class="bar color-white no-mb background-iso">
    <div class="container">
        <div class="row flex-centered">
            <div class="col-md-6 text-center">
                <div class="clients-text-bl">
                    <div>
                        <span>более</span>
                        <span class="num">1000</span>
                    </div>
                    <div>
                        <span>клиентов</span>
                    </div>
                </div>
            </div>
            <div class="col-md-3 text-center">
                <div>
                    <img src="../img/ico-iso-9001.png" alt="">
                    <p class="iso-text">Сертифікат управління якістю</p>
                </div>
            </div>
            <div class="col-md-3 text-center">
                <div>
                    <img src="../img/ico-iso-27001.png" alt="">
                    <p class="iso-text">Сертифікат безпеки</p>
                </div>
            </div>
        </div>
    </div>
</section>

<!-- /.bar -->
<?php
    if (!empty($brands)) {
        ?>
      <section class="bar background-gray no-mb">
        <div class="container">
          <div class="row">
            <div class="col-md-12">
              <div class="heading text-center">
                <h2><?php echo \Yii::t('app', 'Бренды'); ?></h2>
              </div>
  
              <ul class="owl-carousel customers brand-carousel">
                  <?php
                      foreach ($brands as $brand) {
                          echo Html::tag(
                              'div',
                              Html::img(
                                  ImageHelper::set($brand->image->getPath())
                                             ->setWidth(150)
                                             ->render(),
                                  [
                                      'class' => 'img-responsive',
                                  ]
                              ),
                              [
                                  'class' => 'item',
                              ]
                          );
                      }
                  ?>
              </ul>
              <!-- /.owl-carousel -->
            </div>
          
          </div>
        </div>
      </section>
        <?php
    }
?>
<section class="bar background-white no-mb">
  <div class="container">
    
    <div class="col-md-12">
      <div class="heading text-center">
        <h2>Полезные статьи</h2>
      </div>
        <p class="lead">
            Облачные технологии — одна из самых динамично развивающихся сфер IT.  Узнать информацию про cloud computing будет полезно для тех, кто активно интересуется технологическими новинками.
            <a href="/blog/index">Почитайте наш блог!</a>
        </p>

      
      <!-- *** BLOG HOMEPAGE ***
_________________________________________________________ -->
      
      <div class="row">
          
          <?php foreach ($articles as $article) { ?>
            <div class="col-md-3 col-sm-6">
              <div class="box-image-text blog">
                <div class="top">
                  <div class="image">
                      <?= ImageHelper::set(
                          $article->image ? $article->image->getPath() : '@frontend/web/img/no-image.png'
                      )
                                     ->cropResize(255, 192)
                                     ->renderImage(
                                         [
                                             'class' => 'img-responsive',
                                             'alt'   => $article->lang->title,
                                         ]
                                     ) ?>
                  </div>
                  <div class="bg"></div>
                  <div class="text">
                    <p class="buttons">
                      <a href="<?= Url::to(
                          [
                              'blog/article',
                              'id' => $article->id,
                          ]
                      ) ?>" class="btn btn-template-transparent-primary"><i class="fa fa-link"></i> <?php echo \Yii::t(
                              'app',
                              'Read more'
                          ); ?></a>
                    </p>
                  </div>
                </div>
                <div class="content">
                  <h4><a href="<?= Url::to(
                          [
                              'blog/article',
                              'id' => $article->id,
                          ]
                      ) ?>"><?= $article->lang->title; ?></a></h4>
                    <?php if ( !empty($article->category) ) { ?>
                  <p class="author-category"><a href="<?= Url::to(
                          [
                              'blog/category',
                              'id' => $article->category->id,
                          ]
                      ) ?>"><?= $article->category->lang->title ?></a>
                      <?php } ?>
                  </p>
                  <p class="intro"><?= $article->lang->body_preview; ?></p>
                  <p class="read-more">
                    <a href="<?= Url::to(
                        [
                            'blog/article',
                            'id' => $article->id,
                        ]
                    ) ?>" class="btn btn-template-main"><?php echo \Yii::t('app', 'Continue reading'); ?></a>
                  </p>
                </div>
              </div>
              <!-- /.box-image-text -->
            </div>
          <?php } ?>
      
      </div>
      <!-- /.row -->
      
      <!-- *** BLOG HOMEPAGE END *** -->
    
    </div>
  
  </div>
  <!-- /.container -->
</section>
<!-- /.bar -->


<section class="bar background-white no-mb">
  <div class="container">
    <div class="col-md-12">
        <?php echo $seo->text; ?>
    </div>
  </div>
</section>