<?php
/* DCMS Special
 * Дата последнего редактирования 01.02.2016
 * Модифицировал densnet
 */

foreach (array('start', 'compress', 'sess', 'settings', 'db_connect', 'ipua', 'fnc', 'user') as $inc) {
    require_once "../../sys/inc/$inc.php";
}

$set['title'] = lang('Лучшие фото');
require_once H . 'sys/inc/thead.php';

aut();
err();

#Навигация
echo "<div class='list-group-item-null list-group-item-grey'><small>";
echo "<a href='/' class='hint--right' data-hint='" . lang('На главную') . "'><i class='fa fa-home fa-lg'></i></a> <i class='fa fa-angle-right fa-fw'></i> ";
echo "<a href='/modules/foto/'>" . lang('Фотоальбомы') . "</a> <i class='fa fa-angle-right fa-fw'></i> ";
echo lang('Лучшие фото');
echo "</small></div><br />";

$set['p_str'] = 30;
$k_rxn = mysql_num_rows(mysql_query("SELECT `id_foto` FROM `gallery_rating` WHERE `like` > 0"));
$k_page = k_page($k_rxn, $set['p_str']);
$page = page($k_page);
$start = $set['p_str'] * $page - $set['p_str'];

if ($k_rxn == 0) {
    $doc->NoResult();
}

$r_xn = mysql_query("SELECT * FROM `gallery_rating` WHERE `like` > '0' ORDER BY `like` DESC LIMIT $start, $set[p_str]");
?>
<link rel="stylesheet" href="/style/css/owl.carousel.css">
<link rel="stylesheet" href="/style/css/owl.theme.default.min.css">
<script src="/style/js/owl.carousel.js"></script>

<script>
    $('.owl-carousel').owlCarousel({
        loop: true,
        margin: 10,
        nav: true,
        responsive: {
            0: {
                items: 1
            },
            600: {
                items: 3
            },
            1000: {
                items: 5
            }
        }
    })

    $(document).ready(function () {
        $(".owl-carousel").owlCarousel();
    });
</script>
<?php
echo "<div class='owl-carousel owl-theme'>";
while ($ank = mysql_fetch_array($r_xn)) {

    $f = $ank['id_foto'];
    $foto = mysql_fetch_assoc(mysql_query("SELECT * FROM `gallery_rating` WHERE `id_foto` = '" . $f . "'  LIMIT 1"));
    $gallery = mysql_fetch_assoc(mysql_query("SELECT * FROM `gallery` WHERE `id`='" . $foto['avtor'] . "'  LIMIT 1"));
    $ank_p = get_user($gallery['id_user']);


    echo "<div class='item'>";
    echo "<img src='/modules/foto/foto/$foto[id_foto]' /><br />";
    echo "<small class='text-muted'><i class='fa fa-star fa-fw'></i> $foto[like]</small>";
    echo "</div>";
}
echo "</div>";

if ($k_page > 1) {
    str("rating.php?", $k_page, $page);
}

require_once H . 'sys/inc/tfoot.php';
