Blame view

protected/views/tuning/index.php 3.98 KB
a1684257   Administrator   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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
  <?php
  /**
   * @var $this TuningController
   * @var $brands TuningBrand[]
   * @var $contacts Contact[]
   */
  ?>
  <?php $this->renderPartial('//snippets/headerGallery'); ?>
  
  <div class="wrapper content-wrapper">
      <div class="col-wrapper">
          <div class="col2">
              <p class="section-title"><?php echo Yii::t('site', 'Наши услуги');?></p>
              <ul class="sidebar-nav">
                  <?php foreach ($this->getServices() as $item): ?>
                  <li><?php echo CHtml::link($item->i18n->name, array('tuning/service', 'link' => $item->link));?></li>
                  <?php endforeach; ?>
              </ul>
              <p class="section-title"><?php echo Yii::t('site', 'Марки авто');?></p>
              <ul class="sidebar-nav">
                  <?php foreach ($this->getBrands() as $brand): ?>
                  <li><?php echo CHtml::link($brand->i18n->name, array('tuning/brand', 'brand' => $brand->link));?></li>
                  <?php endforeach; ?>
              </ul>
          </div>
          <div class="col8">
              <h1><?php echo $this->pageName?></h1>
  
              <div class="catalog-wrapper">
                  <?php
                  /** @var $buff TuningBrand[] */
                  $buff = array();
                  foreach ($brands as $brand) {
                      if (count($buff) % 3 == 0) {
                          foreach ($buff as $b) $this->renderPartial('_brandModels', array('b' => $b));
                          $buff = array();
                      }
                      $buff[] = $brand;
                      ?>
                      <a href="<?php echo CHtml::encode($this->createUrl('tuning/brand', array('brand' => $brand->link)))?>"
                         data-id="brand-<?php echo $brand->id?>-models"
                         class="catalog-item">
                      <span class="catalog-item-logo-wrap">
                          <span class="catalog-item-logo"
                                style="background-image: url(<?php echo CHtml::encode($brand->imageBehavior->getFileUrl())?>);">
                          </span>
                      </span>
                          <span class="catalog-item-name"><?php echo $brand->i18n->name?></span>
                          <span class="catalog-item-tail"></span>
                      </a>
                      <?php
                  }
                  foreach ($buff as $b) $this->renderPartial('_brandModels', array('b' => $b));
                  $buff = array();
                  ?>
              </div>
  
              <div class="text-content">
                  <h2><?php echo Yii::t('site', 'Что делать, если вашей марки или модели авто нет в перечне?');?></h2>
  
                  <p><?php echo Yii::t('site', 'Здесь выставленны примеры работ. Возможность тюнинга именно вашего авто вы можете уточнить у нашего специалиста не откладывая:');?></p>
              </div>
              <?php echo $this->tuningRoot->i18n->contact_info?>
          </div>
          <div class="col2">
              <p class="section-title"><?php echo Yii::t('site', 'Есть вопросы?');?></p>
  
              <div class="text-content">
                  <?php echo Yii::t('site', 'Обращайтесь к вашему персональному консультанту по тюнингу!');?>
              </div>
              <?php $this->renderPartial('//snippets/sidebarContacts');?>
          </div>
      </div>
  </div>
  
  
  <?php
  /** @var $cs CClientScript */
  $cs = Yii::app()->clientScript;
  $src = <<<EOD
  var current;
  $(".catalog-item").click(function(e){
      var id = '#'+$(this).data('id');
      if($(id).length && (!$(this).hasClass('opened'))) e.preventDefault();
      else return;
      if(!!current){
          $('#'+current.data('id')).css('display','none');
          current.removeClass('opened');
      }
      current = $(this).addClass('opened');
      $(id).css('display','block');
  });
  EOD;
  $cs->registerCoreScript('jquery');
  $cs->registerScript('catalog', $src);
  ?>