<?php
/**
 * @var $this SiteController
 * @var $sidebar string
 * @var $contacts Contact[]
 * @var $reviews Review[]
 */
?>
<?php $this->renderPartial('//snippets/headerGallery');?>

<div class="wrapper content-wrapper">
    <div class="col-wrapper">
        <div class="col2">

            <div class="text-content">
                <?php echo $sidebar;?>
            </div>
        </div>
        <div class="col8">
            <h1><?php echo CHtml::encode($this->pageName);?></h1>

            <div class="testimonials-wrap">
                <?php foreach ($reviews as $review): ?>
                <div class="testimonial-item">
                    <div class="col2">
                        <?php echo CHtml::link(CHtml::image($review->imageBehavior->getFileUrl('medium')),$review->imageBehavior->getFileUrl(),array('rel'=>'review-gallery'));?>
                    </div>
                    <div class="col6 with-margin">
                        <div class="text-content">
                            <blockquote><?php echo CHtml::encode($review->i18n->comment);?></blockquote>
                        </div>
                        <div class="testimonial-item-info">
                            <p class="date"><?php
                                $timestamp = CDateTimeParser::parse($review->date, 'yyyy-MM-dd');
                                echo Yii::app()->getDateFormatter()->format('d MMMM yyyy', $timestamp);
                                ?></p>

                            <p>
                                <b><?php echo CHtml::encode($review->i18n->name)?></b><?php if (!empty($review->i18n->link_text)): ?>,
                                <a href="<?php echo CHtml::encode($review->i18n->link_url)?>"><?php echo CHtml::encode($review->i18n->link_text)?></a>
                                <?php endif;?>
                            </p>

                        </div>
                    </div>
                </div>
                <?php endforeach;?>
            </div>
        </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=review-gallery]").fancybox({
	'transitionIn'	: 'none',
	'transitionOut'	: 'none',
	'titlePosition' : 'over'
});
JS;

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