index.php 3.98 KB
<?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);
?>