main.php 13.5 KB
<?php
/**
 * @var $this Controller
 */
//header('X-XSS-Protection:0');
?>

<!DOCTYPE HTML>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>

    <meta name="language" content="en"/>

    <link type="text/css" rel="stylesheet" href="<?php echo Yii::app()->request->baseUrl; ?>/css/style.css"/>
    <!--[if IE 7]>
    <link rel="stylesheet" type="text/css" href="<?php echo Yii::app()->request->baseUrl; ?>/css/ie7.css"/>
    <![endif]-->
    <title><?php echo CHtml::encode($this->pageTitle); ?></title>
    <?php

    if (!empty($this->keywords))
        echo '    <meta name="keywords" content="', CHtml::encode($this->keywords), '"/>', "\n";

    if (!empty($this->description))
        echo '    <meta name="description" content="', CHtml::encode($this->description), '"/>', "\n";
    ?>
    <?php
    $css = Yii::app()->getClientScript();
    $css->registerCssFile('/css/bootstrap/css/bootstrap.min.css');
    ?>
    <script type="text/javascript">

        var _gaq = _gaq || [];
        _gaq.push(['_setAccount', 'UA-27775302-1']);
        _gaq.push(['_trackPageview']);

        (function () {
            var ga = document.createElement('script');
            ga.type = 'text/javascript';
            ga.async = true;
            ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
            var s = document.getElementsByTagName('script')[0];
            s.parentNode.insertBefore(ga, s);
        })();

    </script>
</head>
<body>



<!-- Modal -->
<div class="modal fade " id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
    <div class="modal-dialog" role="document">
        <div class="modal-content send_sto_form">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                <h4 class="modal-title" id="myModalLabel">Введите ваши данные</h4>
            </div>
            <form id="sto-form" class="form-horizontal">
                <div class="form-group">
                    <label for="exampleInputName">Имя</label>
                    <input type="text" class="form-control" name="name" id="exampleInputName" required />
                </div>
                <div class="form-group">
                    <label for="exampleInputEmail">Email</label>
                    <input type="email" class="form-control" name="email" id="exampleInputEmail" />
                </div>
                <div class="form-group">
                    <label for="exampleInputPhone">Номер телефона</label>
                    <input type="text" class="form-control" name="phone" id="exampleInputPhone"  required />
                </div>
                <div class="modal-header">
                    <button type="submit" class="btn btn-primary">Отправить</button>
                </div>
            </form>
        </div>
    </div>
</div>









<!-- up button -->
<div class="up-btn-wrapper" style="bottom: 30px; left: 136px" id="back-top">
    <!-- top = any num, mb window.height/2; left=(window.width-1000)/2 -->
    <a class="up-btn"><?php echo Yii::t('site', 'Наверх');?></a>
</div>
<!-- end up button -->

<div id="fb-root"></div>
<script>(function (d, s, id) {
    var js, fjs = d.getElementsByTagName(s)[0];
    if (d.getElementById(id)) return;
    js = d.createElement(s);
    js.id = id;
    js.src = "//connect.facebook.net/ru_RU/all.js#xfbml=1&appId=484895001520612";
    fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));</script>
<?php $this->renderPartial('//snippets/bigGallery');?>
<div class="modal-wrapper letter" style="display: none;" id="contact_form">
    <?php
    if (isset($this->contactForm->contact)) {
        /** @var $contact Contact */
        $contact = Contact::model()->with('i18n')->findByPk($this->contactForm->contact);
    }
    ?>
    <div class="center-wrapper">
        <div class="modal-content">
            <a class="modal-close"></a>

            <div class="consultant">
                <div class="consultant-photo">
                    <?php echo isset($contact) ? CHtml::image($contact->imageBehavior->getFileUrl(), '', array('width' => 222)) : '<img src="" width="222"/>' ?>
                </div>
                <p class="consultant-name"><?php if (isset($contact)) echo $contact->i18n->name ?></p>

                <p class="consultant-speciality"><?php if (isset($contact)) echo $contact->i18n->position ?></p>

                <p class="asd"><b><?php if (isset($contact)) echo $contact->phone ?></b><br/>
                    <a href="mailto:<?php if (isset($contact)) echo $contact->email ?>"><?php if (isset($contact)) echo $contact->email ?></a>
                </p>
            </div>

            <div class="text-content">
                <p>&nbsp;</p>
            </div>
            <div class="form-content">
                <div class="form-wrap in-col6">
                    <?php
                    /** @var $form CActiveForm */
                    $form = $this->beginWidget('CActiveForm');
                    echo $form->textField($this->contactForm, 'link', array('style' => 'display:none;'));
                    echo $form->hiddenField($this->contactForm, 'contact');
                    ?>
                    <div class="form-line">
                        <?php
                        echo $form->label($this->contactForm, 'name');
                        echo $form->textField($this->contactForm, 'name', array('class' => 'middle'));
                        ?>
                    </div>
                    <div class="form-line">
                        <?php
                        echo $form->label($this->contactForm, 'email');
                        echo $form->textField($this->contactForm, 'email', array('class' => 'middle'));
                        ?>
                    </div>
                    <div class="form-line">
                        <?php
                        echo $form->label($this->contactForm, 'phone');
                        echo $form->textField($this->contactForm, 'phone', array('class' => 'middle'));
                        ?>
                    </div>
                    <div class="form-line">
                        <?php
                        echo $form->label($this->contactForm, 'body');
                        echo $form->textArea($this->contactForm, 'body', array('class' => 'wide'));
                        ?>
                    </div>

                    <div class="form-line with-submit">
                        <input type="submit" class="button"
                               value="<?php echo Yii::t('site', 'Отправить сообщение');?>"/>
                    </div>
                    <?php
                    $this->endWidget();
                    ?>

                </div>
            </div>
        </div>
    </div>
</div>
<div class="wrapper-global">
    <div class="center-wrapper">
        <div class="wrapper">
            <!-- header start-->
            <?php $this->renderPartial('//snippets/header');?>
            <!-- header end-->
            <?php echo $content?>
        </div>
    </div>
    <div class="push"></div>
</div>
<?php $this->renderPartial('//snippets/footer')?>
<!-- Yandex.Metrika counter -->
<div style="display:none;">
    <script type="text/javascript">
        (function (w, c) {
            (w[c] = w[c] || []).push(function () {
                try {
                    w.yaCounter11889511 = new Ya.Metrika({id:11889511, enableAll:true, ut:"noindex", webvisor:true});
                }
                catch (e) {
                }
            });
        })(window, "yandex_metrika_callbacks");
    </script>
</div>
<script src="//mc.yandex.ru/metrika/watch.js" type="text/javascript" defer="defer"></script>
<noscript>
    <div><img src="//mc.yandex.ru/watch/11889511?ut=noindex" style=" left:-9999px;" alt=""/></div>
</noscript>
<!-- /Yandex.Metrika counter -->

<div style="display:none;">
    <!-- Google Code for all visitors 60 days -->
    <!-- Remarketing tags may not be associated with personally identifiable information or placed on pages related to sensitive categories. For instructions on adding this tag and more information on the above requirements, read the setup guide: google.com/ads/remarketingsetup -->
    <script type="text/javascript">
        /* <![CDATA[ */
        var google_conversion_id = 1017652643;
        var google_conversion_label = "0CKrCIWpiQQQo8ug5QM";
        var google_custom_params = window.google_tag_params || {};
        var google_remarketing_only = true;
        google_custom_params['style'] = 'display:none;';
        /* ]]> */
    </script>
    <script type="text/javascript" src="//www.googleadservices.com/pagead/conversion.js">
    </script>
    <noscript>
        <div style="display:inline;">
            <img height="1" width="1" style="border-style:none;" alt=""
                 src="//googleads.g.doubleclick.net/pagead/viewthroughconversion/1017652643/?value=0&amp;label=0CKrCIWpiQQQo8ug5QM&amp;guid=ON&amp;script=0"/>
        </div>
    </noscript>
</div>
</body>
</html>
<?php
/** @var $cs CClientScript */
$cs = Yii::app()->getClientScript();
$cs->registerCoreScript('jquery');
$needOpenContact = CJavaScript::encode($this->contactForm->hasErrors());
$contactFieldId = CHtml::activeId($this->contactForm, 'contact');
$src = <<<JS
function openContactForm(text){
//    $(window).scrollTop(0);
    $('body').addClass('no-scroll');
    var form = $('#contact_form');
    form.show();
    form.click(function(e){
       if(e.target.id=='contact_form')closeContactForm();
    });
    var mc =$('.modal-content',form);

    if(!text){
        $('.text-content',mc).css('display','none');
        $('.form-content',mc).css('display','block');
    } else {
        $('.text-content',mc).css('display','block');
        $('.form-content',mc).css('display','none');
        $('.text-content p',mc).html(text);
    }
    var w = mc.outerWidth();
    var h = mc.outerHeight();
    if ($(window).height() > h){
        mc.css({
            'margin-left':(mc.parent().width()-w)/2,
            'margin-top':($(window).height()-h)/2
        })
    }
    else {
        mc.css({
             'margin-left':(mc.parent().width()-w)/2,
             'margin-top': 40,
             'margin-bottom': 40
        })
    }
    $('input[type=submit]', form).click(function(){
        _gaq.push(['_trackEvent', 'Mail', 'Визитка попап', $('.consultant-name', form).text()]);
    })
}

function closeContactForm(){
    $('body').removeClass('no-scroll');
    $('#contact_form').hide();
}

$('#contact_form .modal-close').click(closeContactForm);
$('.consultant').each(function(){
    var c = $(this);
    //image name email position phone contact
    function fillForm(f){

        $('#contact_form .consultant-name').text(c.data('name'));
        $('#contact_form .consultant-speciality').text(c.data('position'));
        $('#contact_form .asd b').text(c.data('phone'));
        $('#contact_form .asd a').attr('href','mailto:'+c.data('email').toString()).text(c.data('email'));
        $('#'+'$contactFieldId').attr('value',c.data('contact'));
        var img =c.data('image');
        var oldImg = $('#contact_form .consultant-photo img').attr('src');
        if(img != oldImg)
            $('#contact_form .consultant-photo img').load(function(){f('');}).attr('src',img);
        else
            f('');
    }

    $('.consultant-photo img, a, p a',c).click(function(e){
        e.preventDefault();
        _gaq.push(['_trackEvent', 'Mail', 'Визитка справа', c.data('name').toString()]);
        fillForm(openContactForm);

    });
    $('#contact_form .asd a').click(function(){
        _gaq.push(['_trackEvent', 'Mail', 'mailto', c.data('email').toString()]);
    })
}) ;
if($needOpenContact) openContactForm('');
JS;

if (Yii::app()->user->hasFlash('contact')) {
    $src .= "\n openContactForm(" . CJavaScript::encode(Yii::app()->user->getFlash('contact')) . ');';
}
$cs->registerScript('contactForm', $src);

//$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
$('.text-content img').each(function(){
    var img = $(this);
    var src = img.attr('src');
    if(img.attr('width')&&(!img.parent().hasClass('lightbox'))){
        img.replaceWith($('<a class="lightbox" href="'+src+'"/>').append(img.clone()));
    }
})  ;
var gallery = $("a.lightbox").attr('rel','lightbox').fancybox({
	'transitionIn'	: 'none',
	'transitionOut'	: 'none'
});
JS;

$cs->registerScript('content_gallery', $src);
$cs->registerScript('bak_to_top', <<<JS
    var backToTopPos = $(".wrapper").position();
    $("#back-top").css({
    'bottom':($(window).height()/2)+'px',
    'left':backToTopPos.left-$("#back-top").width() +'px'}).hide();

    if($('.hide-back-top').length == 0)
	$(function () {
		$(window).scroll(function () {
		    var pos = $(this).scrollTop();
		    if (pos > 700) {
				$('#back-top').fadeIn();
			} else {
				$('#back-top').fadeOut();
			}
		});

		$('#back-top a').click(function () {
			$('body,html').animate({
				scrollTop: 0
			}, 800);
			return false;
		});
	});
JS
);
$cs->registerScript('MCE', <<<JS
    $('#mce-EMAIL')
    .data('holder',$('#mce-EMAIL').attr('placeholder'))
    .focusin(function(){ $(this).attr('placeholder',''); })
    .focusout(function(){ $(this).attr('placeholder',$(this).data('holder')); });
JS
)
?>