<?php
/**
 * Copyright (c) 2016 Serhii Borodai <clarifying@gmail.com>.
 *
 * Permission is hereby granted, free of charge, to any person obtaining a copy
 * of this software and associated documentation files (the "Software"), to deal
 * in the Software without restriction, including without limitation the rights
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 * copies of the Software, and to permit persons to whom the Software is
 * furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in
 *  all copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 * THE SOFTWARE.
 *
 *
 */

/** @var $this \Zend\View\Renderer\PhpRenderer */
$this->headScript()
    ->appendFile('/js/script-install-counter.js')
;

$this->headLink()
    ->appendStylesheet('/css/styles-install-counter.css')
    ->appendStylesheet('/css/styles-install-counter-550.css', 'all and (max-width: 550px)')
;


/** @var \App\Entity\Site $site */
$site = $this->site;

/** @var \App\Entity\IdentityInterface $identity */
$identity = $this->identity();
$gravatar = $this->gravatar($identity->getEmail());
$gravatar->setDefaultImg(\Zend\View\Helper\Gravatar::DEFAULT_IDENTICON);
$sxml = new SimpleXMLElement(substr($gravatar, 0, -1) . '/>');
$src = $sxml['src'];
?>
<section class="b-content__title">
    <div class="wrapp">
        <picture>
            <img src="/img/bg-img-logo.svg" alt="No logo">
        </picture>
        <p class="lead"><?= $identity->getEmail() ?></p>
        <p class="b-content__title-settings">
            <a href="<?= $this->url('user.cabinet.profile',['lang' => $this->lang]) ?>" title="" class="annotation"><?= _t("Настройки профиля") ?></a>
            <a href="#" title="" class="annotation"><?= _t("Выход") ?></a>
        </p>
    </div>
</section>

<section class="b-content__counter">
    <div class="wrapp">
        <h1 style="<?= $site->getDomain() ? "background-image: url('http://" . $site->getDomain() . "/favicon.ico');" : '' ?>">
            <?= $site->getDomain() ?></h1>
        <p class="text"><?= _t("Интегрируйте наш счётчик бесплатно и оцените потери сайта из-за блокировщиков.") ?></p>
        <div class="b-content__message b-content__counter-download">
            <textarea style="input: input--akira">&lt;script type="text/javascript"&gt;
<?= $this->partial('download::counter-script', ['uuid' => $identity instanceof \App\Entity\User ? $identity->getUuid() : '', 'domain' => $site->getDomain(), 'fullname']) ?>
&lt;/script&gt;</textarea>
        </div>
        <div class="b-content__message b-content__counter-download">
            <p>
                <a href="<?= $this->url('download.counter', ['lang' => $this->lang, 'siteId' => $site->getId() ?? '']) ?>" title="<?= _t('Скачать счетчик') ?>" class="text">addcpm_counter_and_manual.zip</a><br />
                <span class="annotation">23 kb</span>
            </p>
            <a href="<?= $this->url('download.counter', ['lang' => $this->lang, 'siteId' => $site->getId() ?? '']) ?>" title="<?= _t('Скачать счетчик') ?>" class="button text bold download-counter"><?= _t("Скачать") ?></a>
        </div>
        <p class="b-content__help">
            <a href="<?= $this->url('faq', ['lang' => $this->lang]) ?>" title="<?= _t('Помощь') ?>" class="text"><?= _t("Помощь") ?></a>
        </p>
    </div>
</section>

