<?
$cena=50; // цена очистки трудовой
if(isset($_GET['clean']) && $ank['id']==$ku['id'])
{
if($ku['rubies']>=$cena)
{
if(isset($_GET['ok']))
{
mysql_querll("UPDATE `kolhoz_user` SET `rubies` = '".($ku['rubies']-$cena)."' WHERE `id` = '$ank[id]'");
mysql_querll("DELETE FROM `kolhoz_collective_history` WHERE `id_user` = '$ank[id]'");
echo "<div class='feedback'><ul class='feedbackPanel'><li class='feedbackPanelINFO'><span class='feedbackPanelINFO'>Трудовая успешно очищена!</span></li></ul></div>";
}
else
{
podtv("?user=$ank[id]&history&clean&ok","?user=$ank[id]&history");
include_once 'inc/foot.php';
}
}
else no_rubies($cena-$ku['rubies']);
}
echo "<div class='event'><h1><a href='?user=$ank[id]'>$au[nick]</a> / Трудовая книжка</h1></div>";
echo '<div class="content">
<div class="block">';
$k_post = mysql_result(mysql_querll("SELECT COUNT(*) FROM `kolhoz_collective_history` WHERE `id_user` = '$ank[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_querll("SELECT * FROM `kolhoz_collective_history` WHERE `id_user` = '$ank[id]' ORDER BY `time` DESC LIMIT $start, 10");
echo "<ul>";
while($post=mysql_fetch_array($q))
{
$num++;
$who=mysql_fetch_array(mysql_querll("SELECT * FROM `kolhoz_user` WHERE `id` = '$post[id_who]'"));
$whou=$who;
$ct=mysql_fetch_array(mysql_querll("SELECT * FROM `kolhoz_collective` WHERE `id` = '$post[id_collective]'"));
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>принял".($whou['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>покинул".($whou['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>исключил".($whou['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>повысил".($whou['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>понизил".($whou['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("?user=$ank[id]&history&",$k_page,$page); // Вывод страниц
if($ank['id']==$ku['id'])echo "<div class='pt'><img width='16' height='16' src='images/icons/tick.png' alt='o'> <a href='?user=$ank[id]&history&clean'><span>Очистить трудовую</span></a> (<span>Стоимость</span>: <span><img width='16' height='16' src='images/icons/ruby.png' alt='o'> <span class='title'>$cena</span></span>)</div>";
echo "</div>";
include_once 'inc/foot.php';
?>