partner.php 5.7 KB
<?php
/**
 * @var $this PartnersSectionController
 * @var $partners Partner[]
 * @var $partner Partner
 * @var $contacts Contact
 */
?>
<?php $this->renderPartial('//snippets/headerGallery'); ?>
<!-- header end-->
<div class="wrapper content-wrapper">
    <div class="col-wrapper">
        <div class="col2 aside-no-title">
            <?php
            $items = array();
            foreach ($partners as $item) {
                $items[] = array(
                    'label' => $item->i18n->name,
                    'url' => $this->createUrl('partnersSection/partner', array('link' => $item->link)),
                    'active' => $item->id == $partner->id,
                );
            }
            $sideMenu = array(
                array('url' => $this->createUrl('about/index', array('node_id' => $this->root_node_id)), 'label' => Yii::t('site', 'О компании')),
            );
            foreach ($this->getRootNode()->nodes as $node)
                if (!$node->hidden) {
                    $sideMenuItem = null;
                    switch ($node->data_type) {
                        case('partnersSection'):
                            $sideMenuItem = array(
                                'url' => $this->createUrl('partnersSection/partners', array('node_id' => $node->id)),
                                'label' => $node->i18n->label,
                            );
                            break;
                        case('jobsSection'):
                            $sideMenuItem = array(
                                'url' => $this->createUrl('jobsSection/jobs', array('node_id' => $node->id)),
                                'label' => $node->i18n->label,
                            );
                            break;
                        case('aboutSection'):
                            $sideMenu[] = array(
                                'url' => $this->createUrl('aboutSection/index', array('node_id' => $node->id)),
                                'label' => $node->i18n->label,
                            );
                            break;
                    }
                    if (!empty($sideMenuItem)) {
                        $sideMenuItem['active'] = $node->id == $this->node_id;
                        if ($sideMenuItem['active']) {
                            $sideMenuItem['items'] = $items;
                        }
                        $sideMenu[] = $sideMenuItem;
                    }
                }
            $this->widget('zii.widgets.CMenu', array(
                'items' => $sideMenu,
                'htmlOptions' => array('class' => 'sidebar-nav'),
            ));
            ?>
            <?php $this->renderPartial('//about/_photoFeed', array('galleryId' => $this->getAboutRoot()->photo_gallery_id));?>
        </div>
        <div class="col8">
            <h1><?php echo CHtml::encode($this->pageName)?></h1>

            <div class="text-content">
                <?php echo $partner->i18n->content1 ?>
            </div>

            <h2><?php echo Yii::t('site', '{name} тюнинг для автомобилей', array('{name}' => $partner->i18n->name));?></h2>

            <div class="car-marque-list">
                <?php foreach ($partner->brands as $brand): ?>
                <a class="car-marque-item" title="<?php echo CHtml::encode($brand->i18n->name)?>">
                    <span class="car-marque"
                          style="background-image: url(<?php echo CHtml::encode($brand->imageBehavior->getFileUrl('small'))?>);">
                    </span>
                </a>
                <?php endforeach;?>
            </div>
            <?php echo $partner->i18n->content2 ?>

            <?php if ($partner->gallery_id != null && $partner->galleryBehavior->getGalleryPhotoCount() > 0): ?>
            <h2><?php echo $partner->i18n->gallery_heading?></h2>

            <div class="content-wide-gallery">
                <?php
                foreach ($partner->galleryBehavior->getGalleryPhotos() as $photo) {
                    echo CHtml::link(CHtml::image($photo->getUrl('small'), $photo->i18n->name), $photo->getUrl('medium'), array(
                        'rel' => 'gallery',
                    ));
                }
                ?>
            </div>
            <?php endif;?>
            <?php echo $partner->i18n->content3 ?>
        </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
$cs = Yii::app()->clientScript;
$cs->registerCoreScript('jquery');
//$cs->registerScriptFile(Yii::app()->baseUrl . '/js/fancybox/jquery.mousewheel-3.0.4.pack.js');
$cs->registerScriptFile(Yii::app()->baseUrl . '/js/fancybox/jquery.fancybox-1.3.4.pack.js');
$cs->registerCssFile(Yii::app()->baseUrl . '/js/fancybox/jquery.fancybox-1.3.4.css');
$src = <<<JS
$("a[rel=gallery]").fancybox({
	'transitionIn'	: 'none',
	'transitionOut'	: 'none',
	'titlePosition' : 'over',
	'titleFormat'	: function(title, currentArray, currentIndex, currentOpts) {

	    var name = $(currentArray[currentIndex]).data('name'), r = '';
	    var description = $(currentArray[currentIndex]).data('description');
	    name = name?name:''; description = description?description:'';

	    if(name.length) r+='<b>'+name+'</b> ';
		if(description.length) r+=description;
		if(r.length) return '<span id="fancybox-title-over">'+r+'</span>';
        else return '';
	}
});
JS;

$cs->registerScript('fancybox_gallery', $src);
?>