<?



// Если мод попала в вашие руки незаконно, т.е. не из моих рук, просьба сдаться, я же всёравно вас найду!
// мод запрещено использовать как объек заработка денег!
// Имейте совесть и уважение!



if($ku['level']<5)
{
echo'
<div class="event"><h1>С Т О</h1></div>
<div class="content">
<div class="block">
С Т О доступно с 5 уровня!
</div></div>';
include_once 'inc/foot.php';
exit;
}
if(isset($_GET['gos']))
{
if(isset($mc))
{
if(mysql_result(mysql_query("SELECT COUNT(*) FROM `kolhoz_works` WHERE `id` = '$gos[id_plant]' AND (`level` = '$ku[level]' OR `level` < '$ku[level]')"),0)!=0)
mysql_query("UPDATE `kolhoz_user` SET `last_plant` = '$gos[id_plant]' WHERE `id` = '$ku[id]'");
header("Location:?S_T_O");
exit;
}
else err_game("Для начала вступите в колхоз.");
}
include_once 'inc/arend.php';
include_once 'inc/money_work.php';
include_once 'inc/works_seat.php';
include_once 'inc/clean_works.php';
echo "<div class='event'><h1>Работа</h1></div>";

if(isset($_SESSION['cp']))
{
echo "<div class='feedback'><ul class='feedbackPanel'><li class='feedbackPanelINFO'><span class='feedbackPanelINFO'>Бесплатная увольнение с работы будет доступна через ".time_left($ku['time_cp']-$time)."</span></li></ul></div>";
unset($_SESSION['cp']);
}
echo "<div class='content'>";
echo "<div class='block'>";
echo "<div><img width='16' height='16' src='images/icons/refresh.png' alt='o'> <a href='?S_T_O'>Обновить</a></div>";
if($ku['scarecrow_time']>$time)echo "<li><img width='16' height='16' src='images/icons/scarecrow.png' alt='o'> <a class='epic' href='?shop=scarecrow'>Освежитель</a><span class='minor'> на <span>".time_left($ku['scarecrow_time']-$time)."</span></span></li>";
if($ku['time_drakon']>$time)echo "<li><img width='16' height='16' alt='o' src='images/icons/heli3n.png'> <a class='epic' href='?shop=helicopter&3'>Дракон</a><span class='minor'> на <span>".time_left($ku['time_drakon']-$time)."</span></span></li>";
echo "<ul>";
echo "<li class='pt'>";
////ГРЯДКИ
echo "</li>";

$q=mysql_query("SELECT * FROM `kolhoz_mest` WHERE `id_user` = '$ku[id]'");
while($post=mysql_fetch_array($q))
{
echo "<li>";
if($post['id_plant']!=0 && mysql_result(mysql_query("SELECT COUNT(*) FROM `kolhoz_works` WHERE `id` = '$post[id_plant]'"),0)!=0)$plant=mysql_fetch_array(mysql_query("SELECT * FROM `kolhoz_works` WHERE `id` = '$post[id_plant]'"));

echo "<li><img width='48' height='48' src='".(!isset($plant)?"".($post['cultivator']==1?"images/work.png":"images/work.png")."":"images/works/$plant[id].gif")."' alt='o' class='portrait'>";
echo "<div>";
echo "".(!isset($plant)?"<span class='title'>".($post['cultivator']==1?"Выберите работу":"Готов к следующей работе?")."</span>":"<span  class='title'>".hsc($plant['name'])."</span>".($post['time']>$time?"<span class='small minor'> <br/>(Конец работы через <span> ".time_left($post['time']-$time)."</span>)</span>":null)."")."";
echo "</div>";
echo "<div>";
if(isset($plant))
{
if($post['time']<=$time)
{
echo "<img width='16' height='16' src='images/icons/money.png' alt='o'> <a href='?S_T_O&harvest=$post[id]'>Получить оплату</a>";
}
}
else
{
echo "<span>";
if($ku['last_work']!=0 && mysql_result(mysql_query("SELECT COUNT(*) FROM `kolhoz_works` WHERE `id` = '$ku[last_work]'"),0)!=0)$lp=mysql_fetch_array(mysql_query("SELECT * FROM `kolhoz_works` WHERE `id` = '$ku[last_work]'"));
echo "".($post['cultivator']==1?"<img width='16' height='16' src='images/icons/work_icon.png' alt='o'> ".(isset($lp)?"<a href='?S_T_O&seat=$post[id]&select=$lp[id]'><span>".hsc($lp['name'])."</span></a>, <a href='?
S_T_O&seat=$post[id]'><span>другая работа</span></a>":"<a href='?S_T&seat=$post[id]'>выбрать</a>")."":"<img width='16' height='16' src='images/icons/arend.png' alt='o'> <a href='?S_T_O&cultivator=$post[id]'><span style='title'>Готов</span></a>")."";
echo "</span>";
}
if(isset($plant))unset($plant);
echo "</div><div style='clear:both'></div></li>";
}
//echo "</ul>";
//if($ku['last_plant']!=0 && mysql_result(mysql_query("SELECT COUNT(*) FROM `kolhoz_works` WHERE `id` = '$ku[last_plant]'"),0)!=0)$lp=mysql_fetch_array(mysql_query("SELECT * FROM `kolhoz_works` WHERE `id` = '$ku[last_plant]'"));

if(mysql_result(mysql_query("SELECT COUNT(*) FROM `kolhoz_mest` WHERE `id_user` = '$ku[id]'"),0)<15)
echo "<li><img width='48' height='48' src='images/work_clean.gif' alt='o' class='portrait'><div><span class='title'>Новая Работа</span></div><div><img width='16' height='16' src='images/icons/cart.png' alt='o'> <a href='?S_T_O&new_work'>Купить</a> за <span class='title'><img width='16' height='16' src='images/icons/ruby.png' alt='o'><span>".cpg(mysql_result(mysql_query("SELECT COUNT(*) FROM `kolhoz_mest` WHERE `id_user` = '$ku[id]'"),0))."</span> Евро</span></div><div style='clear:both'></div></li>";
if($ku['last_plant']!=0 && mysql_result(mysql_query("SELECT COUNT(*) FROM `kolhoz_works` WHERE `id` = '$ku[last_plant]'"),0)!=0)$lp=mysql_fetch_array(mysql_query("SELECT * FROM `kolhoz_works` WHERE `id` = '$ku[last_plant]'"));
echo "".($ku['time_cp']>$time?"<li><img width='16' height='16' src='images/icons/cross.png' alt='o'> До бесплатного увольнения: <span>".time_left($ku['time_cp']-$time)."</span></li><li><span><img width='16' height='16' src='images/icons/tick.png' alt='o'> <a href='?S_T_O&clean_works'><span>Уволится</span></a>(<span>Стоимость</span>: <span><img width='16' height='16' src='images/icons/ruby.png' alt='o'> <span class='title'>".($ku['count_cp']*10)."</span></span>)</span></li>":"<li><img width='16' height='16' src='images/icons/cross.png' alt='o'> <a href='?S_T_O&clean_works'>Уволится</a></li>")."</ul>";
 if(isset($mc))
{
}
echo '</div>';
include_once 'inc/foot.php';

?>