Файл: zfarm.mobi/inc/collective/history_ct.php
Строк: 131
<?
$title='История колхоза';
include_once '../system/config.php';
$mcu =mysql_fetch_array(mysql_query("SELECT * FROM `kolhoz_collective_user` WHERE `id_user` = '$ku[id]'"));
$ct =mysql_fetch_array(mysql_query("SELECT * FROM `kolhoz_collective` WHERE `id` = '".intval($_GET['history_ct'])."'"));
if(isset($_GET['history_ct']) && ($_GET['history_ct'])!=NULL && mysql_result(mysql_query("SELECT COUNT(*) FROM `kolhoz_collective` WHERE `id` = '".($_GET['history_ct'])."' LIMIT 1"),0)!=0){
echo"<div class='rzd2'></div><div class='menuin2'>";
echo "<div class='title'><a href='/kolhoz/$ct[id]'>".hsc($mc['name'])."</a> / История</h2></div>";
echo '<div class="content">
<div class="div">';
$k_post = mysql_result(mysql_query("SELECT COUNT(*) FROM `kolhoz_collective_history` 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)*$k_page;
$q=mysql_query("SELECT * FROM `kolhoz_collective_history` WHERE `id_collective` = '$ct[id]' ORDER BY `time` DESC LIMIT $start, 10");
echo "<ul>";
while($post=mysql_fetch_array($q))
{
$num++;
$ank=mysql_fetch_array(mysql_query("SELECT * FROM `kolhoz_user` WHERE `id` = '$post[id_user]'"));
$au=$ank;
$who=mysql_fetch_array(mysql_query("SELECT * FROM `kolhoz_user` WHERE `id` = '$post[id_who]'"));
$who=$who;
if($au['pol']==1)$post['status_name']='колхозник';else $post['status_name']='колхозница';
if($post['status']==1)$post['status_name']='председатель';
elseif($post['status']==2)$post['status_name']='зампред';
elseif($post['status']==3)$post['status_name']='агроном';
elseif($post['status']==4)$post['status_name']=($au['pol']==1?'бригадир':'хозяйка');
elseif($post['status']==5)$post['status_name']='староста';
elseif($post['status']==6)$post['status_name']=($au['pol']==1?'механизатор':'товаровёд');
echo "<li>";
if($post['type']=='in')
{
echo "<span>";
echo on_k($who['id']);
echo "<a href='/user/$who[id]'><span>".nc($who['id'])."</span></a></span> <span>принял".($who['pol']==0?'a':null)." в колхоз</span> <span>".hsc($ct['name'])."</span> <span>";
echo on_k($ank['id']);
echo "<a href='/user/$ank[id]'><span>".nc($ank['id'])."</span></a></span>";
}
elseif($post['type']=='out')
{
if($post['dei']=='user')
{
echo "<span>";
echo on_k($ank['id']);
echo "<a href='/user/$ank[id]'><span>".nc($ank['id'])."</span></a></span> <span>покинул".($who['pol']==0?'a':null)." колхоз</span> <span>".hsc($ct['name'])."</span>";
}
else
{
echo "<span>";
echo on_k($who['id']);
echo "<a href='/user/$who[id]'><span>".nc($who['id'])."</span></a></span> <span>исключил".($who['pol']==0?'a':null)." из колхоза</span> <span>".hsc($ct['name'])."</span> <span>";
echo on_k($ank['id']);
echo "<a href='/user/$ank[id]'><span>".nc($ank['id'])."</span></a></span>";
}
}
elseif($post['type']=='st_up')
{
echo "<span>";
echo on_k($who['id']);
echo "<a href='/user/$who[id]'><span>".nc($who['id'])."</span></a></span> <span>повысил".($who['pol']==0?'a':null)."</span> <span>";
echo on_k($ank['id']);
echo "<a href='/user/$ank[id]'><span>".nc($ank['id'])."</span></a></span> до <span>$post[status_name]</span>";
}
elseif($post['type']=='st_down')
{
echo "<span>";
echo on_k($who['id']);
echo "<a href='/user/$who[id]'><span>".nc($who['id'])."</span></a></span> <span>понизил".($who['pol']==0?'a':null)."</span> <span>";
echo on_k($ank['id']);
echo "<a href='/user/$ank[id]'><span>".nc($ank['id'])."</span></a></span> до <span>$post[status_name]</span>";
}
echo " <span class='minor'><span>".vremja($post['time'])."</span></span></li>";
}
echo "</ul>";
if ($k_page>1)str("/kolhoz/info/$ct[id]/history/",$k_page,$page); // Вывод страниц
echo "</div>";
echo"</div></div><div class='rzd2'></div>";
include_once '../system/foot.php';
}
?>