Файл: plugins/list.leaders.php
Строк: 47
<?
if (isset($_GET['sort']) && $_GET['sort'] == 'month') {
$orderTIME = mktime(0, 0, 0, date("m"), 1, date("Y"));
$type = 'month';
} else {
$orderTIME = 0;
$type = 'age';
}
if (isset($_GET['sort']) && $_GET['sort'] == 'montha') {
$orderTIME = mktime(0, 0, 0, date("m")-1, 1, date("Y"));
$type = 'montha';
}
$system['title'] = 'ТОП - Лидеры продаж';
require SYS . 'header.php';
?>
<ul class="nav nav-pills">
<li <?= ($type == 'age' ? 'class="disabled"' : '')?>><a href="?func=<?= $func?>">Общий</a></li>
<li <?= ($type == 'month' ? 'class="disabled"' : '')?>><a href="?func=<?= $func?>&sort=month">За <?= str_m($time)?></a></li>
<li <?= ($type == 'montha' ? 'class="disabled"' : '')?>><a href="?func=<?= $func?>&sort=montha">За <?= str_m($time-2592000)?></a></li>
</ul>
<?
$k_post = count($sql -> selectCol("SELECT id_author
FROM shop_pays
WHERE pays = 1
AND `time_pays` > '" . $orderTIME . "'
GROUP BY id_author"));
if ($k_post == 0) {
?>
<div class="alert" style="margin: 2px;">В топ рейтинге нет участников</div>
<?
} else {
$k_page = k_page($k_post, $system['page_str']);
$page = page($k_page);
$start = $system['page_str'] * $page - $system['page_str'];
$array = $sql -> select("SELECT id_author, SUM( wmr ) AS summa, count( id ) AS count
FROM shop_pays
WHERE pays = 1
AND `time_pays` > '" . $orderTIME . "'
GROUP BY id_author
ORDER BY `summa` DESC LIMIT $start, $system[page_str]");
foreach ($array AS $post) {
$ank = $sql -> fetch("SELECT id, rating FROM `users` WHERE `id` = '$post[id_author]' LIMIT 1");
$num++;
$i = $num + $start;
?>
<div class="<?= ($num % 2 ? "nav1" : "nav2")?>">
<?= $i?>) <?= login($ank['id'], 1)?> <br />
На сумму: <?= $post['summa']?> wmr<br />
Продаж: <?= $post['count']?><br />
Рейтинг: (<?= $ank['rating']/100?>)<br />
<?
$votes = $sql -> fetch("
SELECT COUNT(*) AS pos,
(SELECT COUNT(*) FROM `user_votes` WHERE `id_ank` = '$ank[id]' AND `type` = '0' AND `view` = '1') AS 'otr'
FROM `user_votes` WHERE `id_ank` = '$ank[id]' AND `type` = '1' AND `view` = '1'");
?>
<a href="?func=user.votes&id=<?= $ank['id']?>"><i class="icon-filter"></i> Арбитраж [<span class="on"><?= $votes['pos']?></span>/<span class="off"><?= $votes['otr']?></span>]</a><br />
</div>
<?
}
if ($k_page > 1) {
str('?func=' . $func . '&sort='.$type.'&', $k_page, $page);
}
}
?>