<div class="event"><h1>Колхозы</h1></div>
<div class="content">
<div class="block">
<ul>
<?
////COUNT//
////
$sort='rating';
$sort2='/ratings';
if(isset($_GET['tehnika'])){$sort='tehnika';$sort2='/tehnika';}
if(isset($_GET['arena'])){$sort='arena_rate';$sort2='/arena';}
if(isset($_GET['rating_gos'])){$sort='rating_gos';$sort2='/rating_gos';}
$k_post = mysql_result(mysql_query("SELECT COUNT(*) FROM `kolhoz_collective` WHERE `$sort`>'0'"),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` WHERE `$sort`>'0' ORDER BY `$sort` DESC, `rating` DESC LIMIT $start, $set[p_str]");
echo "<ul>".(isset($mc)?"<span class='title'>Ваш колхоз находится на ".(mysql_result(mysql_query("SELECT COUNT(*) FROM `kolhoz_collective` WHERE `$sort`>'$mc[$sort]'"),0)+1)." месте</span><li class='ptm'></li>":null)."";while($post=mysql_fetch_array($q))
{
$num++;
echo "<li>
<span class='minor'><span>$num.</span></span> <a href='/collective-$post[id]'><span>".hsc($post['name'])."</span></a> <span class='title'>".rating($post["$sort"])."</span>
</li>";
}
echo "</ul>";
if ($k_page>1)new_str("collectives$sort2/",$k_page,$page); // Вывод страниц
?>
<h3>Рейтинг по:</h3>
<ul>
<?
echo "<li><img width='16' height='16' src='images/icons/rating.png' alt='*'> ".($sort!='rating'?"<a href='/collectives'>":"<span>")."Опыту".($sort!='rating'?"</a>":"</span>")."</li>";
echo "<li><img width='16' height='16' src='images/icons/rating.png' alt='*'> ".($sort!='tehnika'?"<a href='/collectives/tehnika'>":"<span>")."Механизации".($sort!='tehnika'?"</a>":"</span>")."</li>";
echo "<li><img width='16' height='16' src='images/icons/rating.png' alt='*'> ".($sort!='arena_rate'?"<a href='/collectives/arena'>":"<span>")."Арене".($sort!='arena_rate'?"</a>":"</span>")."</li>";
echo "<li><img width='16' height='16' src='images/icons/rating.png' alt='*'> ".($sort!='rating_gos'?"<a href='/collectives/rating_gos'>":"<span>")."Госзаказам".($sort!='rating_gos'?"</a>":"</span>")."</li>";
?>
<li class="pt"><img width="16" height="16" src="images/icons/search.png" alt="*"> <a href="/search_collective">Поиск колхоза</a></li>
<li><img width="16" height="16" src="images/icons/plus_small.png" alt="*"> <a href="/collective_create">Создать новый колхоз</a></li>
</ul>
</div>
<?
include_once 'inc/foot.php';
?>