<?
$sort='money';
$img='money.png';
if(isset($_GET['rubies']))
{
$sort='rubies';
$img='ruby.png';
if(isset($_GET['week']))$sort='rubies_week';
}
echo "<div class='event'><h1><a href='/collective-$ct[id]/cash'>Касса</a> / Рейтинг</h1></div>";
?>
<div class="content">
<div class="block">
<ul>
<?
$k_post = mysql_result(mysql_query("SELECT COUNT(*) FROM `kolhoz_collective_user` WHERE `id_collective` = '$ct[id]'"),0);
if ($k_post==0)
{
echo "Список пуст...";
}
$k_page=k_page($k_post,$set['p_str']);
$page=page($k_page);
$start=$set['p_str']*$page-$set['p_str'];
$num=($page-1)*$set['p_str'];
$q=mysql_query("SELECT * FROM `kolhoz_collective_user` WHERE `id_collective` = '$ct[id]' ORDER BY `$sort` DESC LIMIT $start, $set[p_str]");
echo "<ul>";
while($post=mysql_fetch_array($q))
{
$num++;
$uuk=mysql_fetch_array(mysql_query("SELECT * FROM `kolhoz_user` WHERE `id` = '$post[id_user]'"));
echo "<li><span class='minor'><span>$num</span>.</span><span>";
echo "".on_k($uuk['id'])."";
echo " <a class='' href='/user/$uuk[id]'>".nc($uuk['id'])."</a>  <span class='title'><img width='16' height='16' src='images/icons/$img' alt='*'> <span class='title'>$post[$sort]</span></span></li>";
}
echo "</ul>";
if ($k_page>1)str("?collective=$ct[id]&cash&rating&".(isset($_GET['rubies'])?"rubies":"money")."".(isset($_GET['rubies']) && isset($_GET['week'])?"&week":null)."&",$k_page,$page); // Вывод страниц

echo "<div class='pt'>\n
<ul>\n
<li><img width='16' height='16' src='images/icons/ruby.png' alt='*'> ".($sort!='rubies'?"<a href='/collective-$ct[id]/cash/rating/rubies'>":"<span>")."Рейтинг по рубинам за всё время".($sort!='rubies'?"</a>":"</span>")."</li>\n
<li><img width='16' height='16' src='images/icons/clock.png' alt='*'> ".($sort!='rubies_week'?"<a href='/collective-$ct[id]/cash/rating/rubies/week'>":"<span>")."Рейтинг по рубинам за неделю".($sort!='rubies_week'?"</a>":"</span>")."</li>\n
<li><img width='16' height='16' src='images/icons/money.png' alt='*'> ".($sort!='money'?"<a href='/collective-$ct[id]/cash/rating/money'>":"<span>")."Рейтинг по монетам".($sort!='money'?"</a>":"</span>")."</li>\n
</ul>\n
</div>\n
</div>\n";
include_once 'inc/foot.php';
?>