Файл: inc/petfarm/petfarm.php
Строк: 304
<?
$title='Загоны';
$link='barnyard';
include_once '../system/config.php';
define("rub", 1);
include_once '../user/Chest.php';
echo '<img src="http://'.$_SERVER['HTTP_HOST'].'/img/barnyard.jpg">';
if($ku['last_corm'] != '0')
{
$whCorm=mysql_fetch_array(mysql_query(" SELECT * FROM `kolhoz_warehouse` WHERE `id` = '".$ku['last_corm']."' AND `id_user` = '".$ku['id']."' AND `arena` = '1'"));
$plant=mysql_fetch_array(mysql_query("SELECT * FROM `kolhoz_plant` WHERE `id` = '".$whCorm['id_plant']."'"));
}
/* if($ku['id'] != '248' && $ku['id'] != '1')
{
echo "<div class='title'>Идут технические работы.</div>";
echo"<div class='rzd2'></div>";
include_once '../system/foot.php';
} */
if(isset($_SESSION['err']))
{
echo err_game("Не хватает овощей в кормушке");
unset($_SESSION['err']);
}
echo "<div class='rzd2'></div>";
echo "<ul>";
if(mysql_result(mysql_query("SELECT COUNT(*) FROM `kolhoz_petground` WHERE `id_user` = '$ku[id]' AND `id_pet` != '0' AND `time_count` < '$time'"),0)!=0 && $ku['conveyor'] > 0)
{
echo '<a href="/barnyard/harvAll" class="flat-btn1 appleGreen font14"><span class="middle">Собрать всё</span></a>';
}
if(mysql_result(mysql_query("SELECT COUNT(*) FROM `kolhoz_petground` WHERE `id_user` = '$ku[id]' AND `id_pet` != '0' AND `time_corm` < '$time' AND `time_count` > '$time'"),0)!=0 && $ku['fooder'] > 0)
{
echo '<a href="/barnyard/foodAll" class="flat-btn1 appleGreen font14"><span class="middle">Накормить всех</span></a>';
}
if(mysql_result(mysql_query("SELECT COUNT(*) FROM `kolhoz_petground` WHERE `id_user` = '$ku[id]' AND `id_pet` != '0' AND `time_corm` > '$time' AND `time_water` < '$time' AND `time_water` < `time_corm`"),0)!=0)
{
echo '<a href="/barnyard/waterAll" class="flat-btn1 appleGreen font14"><span class="middle">Напоить всех</span></a>';
}
$k_post = mysql_result(mysql_query("SELECT COUNT(*) FROM `kolhoz_petground` WHERE `id_user` = '$ku[id]'"),0);
if ($k_post==0)
{
echo "Список пуст...";
}
$k_page=k_page($k_post,5);
$page=page($k_page);
$start=5*$page-5;
$num=($page-1)*5;
$q=mysql_query("SELECT * FROM `kolhoz_petground` WHERE `id_user` = '$ku[id]' ORDER BY `id` ASC LIMIT $start, 5");
while($post=mysql_fetch_array($q))
{
$pet=mysql_fetch_array(mysql_query("SELECT * FROM `kolhoz_pet` WHERE `id` = '$post[id_pet]'"));
if($post['id_pet']==0)
{
echo '
<div class="flat-content mb0 bg-brown">
<span class="font12 text-bold">Пустой загон</span>
</div>';
echo '<div class="flat-content"><div class="f-animal-dirt font"></div>';
echo '<a href="/barnyard/buy/'.$post['id'].'" class="f-panel-btn-active">
<div class="f-panel-btn-icon-active-animal animal-change"></div>
<div class="f-panel-btn-text change"></div>
</a>
</div>';
}
else
{
if(isset($_GET['moderate']))
{
if($pet['rub']){$img="ruby";}else{$img="money";}
echo '
<div class="flat-content mb0 bg-brown">
<span class="font12 text-bold">'.hsc($pet['name']).' '.($post['time']>$time?'<span style="float: right">'.time_left($post['time']-$time).'</span>':null).'</span>
</div>';
echo '<div class="flat-content"><div class="f-animal-dirt font"><img width="80" height="77" style="padding: 7px;" src="/img/pets/'.$pet['img'].'.png" alt="o"></div>';
echo '<a href="/barnyard/sell/'.$post['id'].'" class="f-panel-btn-active">
<div class="f-panel-btn-icon-active-animal animal-buy"></div>
<center><span class="font12 text-bold"><img src="/img/icons/'.$img.'.png" alt="o"> <span class="n">'.strkol($pet['cena']/2).'</span></span></center>
</a>';
}
else
{
echo '
<div class="flat-content mb0 bg-brown">
<span class="font12 text-bold">'.hsc($pet['name']).'</span>
</div>';
echo '<div class="flat-content">
<div class="f-animal-dirt font">
<img width="80" height="77" style="padding: 7px;" src="/img/pets/'.$pet['img'].'.png" alt="o" class="portrait">
</div>';
$timeCorm = $post['time_corm']-$time;
$timeWater = $post['time_water']-$time;
if($post['time_count'] < $time )
{
echo '<a href="/barnyard/harv/'.$post['id'].'" class="f-panel-btn-active">
<div class="f-panel-btn-icon-active-animal animal-harv"></div>
<div class="f-panel-btn-text harv"></div>
</a>';
}
elseif($post['time_count'] > $time)
{
if($timeCorm > 0 && $timeWater < $timeCorm)
{
if($post['time_water'] > $time)
{
echo '<span class="f-panel-btn-active">
<div class="f-panel-btn-icon-active-animal animal-nowater"></div>
<center><span class="f-panel-btn-time-lock">'.time_left($post['time_water']-$time).'</span></center>
</span>';
}
else
{
echo '<a href="/barnyard/water/'.$post['id'].'" class="f-panel-btn-active">
<div class="f-panel-btn-icon-active-animal animal-water"></div>
<div class="f-panel-btn-text water"></div>
</a>';
}
}
else
{
if($post['time_corm'] > $time)
{
echo '<span class="f-panel-btn-active">
<div class="f-panel-btn-icon-active-animal animal-nofood"></div>
<center><span class="f-panel-btn-time-lock">'.time_left($post['time_corm']-$time).'</span></center>
</span>';
}
else
{
if($ku['last_corm'] != '0' && ($whCorm['count']-3) >= '0')
{
echo '<a href="/barnyard/food/'.$post['id'].'/select/'.$ku['last_corm'].'" class="f-panel-btn-active">
<div class="f-panel-btn-icon-active-animal-icon" style="border-radius: 5px; background-image: url('/img/plants/'.$plant['img'].'.png');"></div>
<div class="f-panel-btn-text food"></div>
</a>';
}
echo '<a href="/barnyard/food/'.$post['id'].'" class="f-panel-btn-active">
<div class="f-panel-btn-icon-active-animal animal-food"></div>
<div class="f-panel-btn-text food"></div>
</a>';
}
}
if($post['time_corm'] > $time && $post['time_count'] > $time)
{
echo '<span class="f-panel-btn-active">
<div class="f-panel-btn-icon-active-animal animal-noharv"></div>
<center><span class="f-panel-btn-time-lock">'.time_left($post['time_count']-$time).'</span></center>
</span>';
}
}
}
echo "</div>";
}
echo "<div style='clear:both'></div></li>";
}
if($ku['conveyor'] > 0 || $ku['fooder'] > 0 || $ku['feeder'] > 0) //Техника
{
echo '<div class="flat-content mb0 bg-brown"><span class="font12 text-bold">Техника</span></div>';
echo '<div class="flat-content"><center>';
if($ku['fooder'] > 0) //Кормушка
{
echo '<a href="/shop/fooder" class="f-panel-btn-active"><div class="f-panel-btn-icon">
<img width="55" height="55" src="/img/icons/feeder.png" alt="o" class="portrait"></div>
<span class="font12 text-bold">Кормушка</span>
</a>';
}
if($ku['feeder'] > 0) //Поилка
{
echo '<a href="/barnyard/" class="f-panel-btn-active"><div class="f-panel-btn-icon">
<img width="55" height="55" src="/img/icons/waterer.png" alt="o" class="portrait"></div>
<span class="font12 text-bold">Поилка</span>
</a>';
}
if($ku['conveyor'] > 0) //Конвеер
{
echo '<a href="/shop/conveyor" class="f-panel-btn-active"><div class="f-panel-btn-icon">
<img width="55" height="55" src="/img/icons/collector.png" alt="o" class="portrait"></div>
<span class="font12 text-bold">Конвеер</span>
</a>';
}
echo '</center></div>';
}
if($ku['garden_ded_time']>$time) //Дед работник
{
echo '<div class="flat-content">';
echo "<img alt='o' width='30' height='30' src='/img/icons/garden3.png'>
<a class='font14 text-bold' href='/shop/garden/id/3'>Работник Дед</a> на <span class='f-panel-btn-time-lock'>".time_left($ku['garden_ded_time']-$time)."</span>
<a href='/shop/garden/sell/3/tim/1'><span class='c-brown text-bold' style='text-decoration: underline;'> продлить?</span></a>";
echo '</div>';
}
if(mysql_result(mysql_query("SELECT COUNT(*) FROM `kolhoz_petground` WHERE `id_user` = '$ku[id]'"),0)<40)
{
echo '<a href="/barnyard/NewFold" class="flat-btn1 appleGreen font14">
<span class="btn-img coin"></span><span class="middle">Купить загон за <span class="nobr"><img src="/img/icons/ruby.png" alt="o"> '.cpg(mysql_result(mysql_query("SELECT COUNT(*) FROM `kolhoz_petground` WHERE `id_user` = '".$ku['id']."'"),0)).'</span></span>
</a>';
}
echo '<a href="/barnyard/page/'.$page.'/moderate" class="flat-btn appleBlue font14">
<span class="btn-img pet_sell"></span><span class="middle">Продать животных</span>
</a>';
if ($k_page>1)str("/barnyard/",$k_page,$page); // Вывод страниц
echo '</ul></div>';
echo "<div class='rzd2'></div>";
include_once '../system/foot.php';
?>