<?
$sort='rating';
$sort2='&rating';
if(isset($_GET['rating_week'])){$sort='rating_week';$sort2='&rating_week';}
if(isset($_GET['tehnika'])){$sort='tehnika';$sort2='&tehnika';}
if(isset($_GET['rating_gos'])){$sort='rating_gos';$sort2='&rating_gos';}

echo "<div class='event'><h1><a href='?collective=$ct[id]'>".hsc($ct['name'])."</a> / Рейтинг по ".($sort=='rating'?"опыту за всё время":null)."".($sort=='rating_week'?"опыту за неделю":null)."".($sort=='tehnika'?"механизации":null)."".($sort=='rating_gos'?"урожаю на госзаказ":null)."</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'><span class='title'>".rating($post[$sort])."</span></span></li>";
}
echo "</ul>";
if ($k_page>1)str("?collective=$ct[id]&selsovet&rating".$sort2."&",$k_page,$page); // Вывод страниц

echo "<div class='pt'>\n
<ul>\n
<li><img width='16' height='16' src='images/icons/clock.png' alt='o'> ".($sort!='rating'?"<a href='?collective=$ct[id]&selsovet&rating'>":"<span>")."Опыт за всё время".($sort!='rating'?"</a>":"</span>")."</li>\n
<li><img width='16' height='16' src='images/icons/clock_week.png' alt='o'> ".($sort!='rating_week'?"<a href='?collective=$ct[id]&selsovet&rating&rating_week'>":"<span>")."Опыт за неделю".($sort!='rating_week'?"</a>":"</span>")."</li>\n
<li><img width='16' height='16' src='images/icons/rating.png' alt='o'> ".($sort!='tehnika'?"<a href='?collective=$ct[id]&selsovet&rating&tehnika'>":"<span>")."Механизация".($sort!='tehnika'?"</a>":"</span>")."</li>\n
<li><img width='16' height='16' src='images/icons/rating.png' alt='o'> ".($sort!='rating_gos'?"<a href='?collective=$ct[id]&selsovet&rating&rating_gos'>":"<span>")."Урожай на госзаказ".($sort!='rating_gos'?"</a>":"</span>")."</li>\n
</ul>\n
</div>\n
</div>\n";
include_once 'inc/foot.php';
?>