<?php
include_once 'configs.php';
?>
<link rel="stylesheet" type="text/css" href="/ajax/profileCover/stylePc.css">
<script src="/ajax/profileCover/index.js"></script>
<div class="profileCoverWrapper">
    <img src="/style/covers/<?= ($ank['profileCover'] ? $ank['profileCover'] : 'default') ?>.jpg" alt="" class="profileCoverImage">
    <div class="profileCoverInfo">
        <div class="profileCoverAvatar">
            <?php
            avatar($ank['id'], '150');
            $a = mysql_fetch_array(mysql_query("SELECT * FROM `gallery_foto` WHERE `id_user`='$ank[id]' AND `avatar`='1' LIMIT 1"));
            if (is_file(H . "sys/gallery/avatar/$a[id].$a[ras]")) {
                
            } else {
                if (isset($user) && $user['id'] == $ank['id']) {
                    echo "<div class='photo_block' style='margin-top: -6px;'><a href='/modules/foto/$ank[id]/' class='hint--top-right' data-hint='" . lang('Загрузите фото в альбом. В выбранном фото нажмите Сделать фотографией профиля') . "'><i class='fa fa-camera fa-fw'></i> " . lang('Загрузить') . "</a></div>";
                }
            }
            ?>
        </div>
    </div>
    <?if (isset($user) && $ank['id'] == $user['id']):?><div class="profileCoverChangeWrapper" onclick="toggles('.profileCoverSelect')"></div><div class="profileCoverChange" onclick="toggles('.profileCoverSelect')"></div><?endif?>
</div>
<?if (isset($user) && $ank['id'] == $user['id']):?>
<div class="profileCoverSelect">
    <div class="profileCoverSelectCategories">
        <?
        $qcats = mysql_query("SELECT * FROM `profileCoversCategories` ORDER BY `name` ASC");
        while ($cat = mysql_fetch_array($qcats)):
        ?>
        <div class="list-group-item-null">
            <a href="#<?= $cat['id'] ?>" onclick="selectCategory(<?= $cat['id'] ?>)"><i class='fa fa-folder fa-fw'></i> <?= htmlspecialchars($cat['name']) ?></a> (<?= mysql_result(mysql_query("SELECT COUNT(*) FROM `profileCoversList` WHERE `id_category` = '$cat[id]'"), 0) ?>) 
            <div class="profileCoverSelectCategory" id="category<?= $cat['id'] ?>">
                <?
                $qcovers = mysql_query("SELECT * FROM `profileCoversList` WHERE `id_category` = '$cat[id]' ORDER BY `id` DESC");
                while ($cover = mysql_fetch_array($qcovers)):
                ?>
                <div class="profileCoverSelectDo" onclick="selectCover(<?= $cover['id'] ?>)">
                    <?show_cover_preview($cover['id'], $preview_sizes['large'])?>
                    <div class="profileCoverSelectPrice"><?= sklon_text($cover['price'], $sklon_balance_array) ?></div>
                </div>
                <?endwhile?>
            </div>
        </div>
        <?endwhile?>
    </div>
</div>
<?endif?>