<?php
define('_IN_JOHNCMS', 1);
$headmod = 'manager';
$textl='Новости'; 
require_once("../incfiles/core.php");
require_once("../incfiles/head.php");
require_once("manfunc.php"); 

if($act=="trans"){$zu="pl_id>0 and club_id=0";$v = 'трансферов';}
else{$zu="pl_id=0 and club_id=0"; $v = 'менеджеров';}

if($id)
{
	$qcj=mysql_query("select * from fman_clubs where id=$id;");
	$t=mysql_fetch_array($qcj);
	$zu="club_id=$id";
	$v=" клуба $t[name]";
}

echo"<h2 align='center'>Новости ".$v."</h2>";
$q=mysql_query("select * from fman_news where ".$zu." order by time desc limit $start,$kmess;");
$qr=mysql_query("SELECT COUNT(*) FROM `fman_news` WHERE ".$zu.";");
$total=mysql_result($qr,0);
if($total>$kmess)
{
	echo '<div class="topmenu">' . functions::display_pagination('news.php?act='.$act.'&amp;', $start, $total, $kmess) . '</div>';
}
while($a=mysql_fetch_array($q))
{
	echo"<div class='menu'>".functions::display_date($a[time])."<br/>";
	if(!$a[pl_id])echo"$a[text]<br/>"; else{

	echo"Игрок: <b>$a[name]</b><br/>Откуда: ";
	if($a[id1])
	{
		$q3=mysql_query("select name from fman_clubs where id=$a[id1];");
		$data1=mysql_fetch_array($q3);
		echo"<a href='club.php?id=$a[id1]'>$data1[name]</a>";
	}
	else
		echo"нет клуба (свободный агент)";

	echo"<br/>Куда: ";
	
	if($a[id2])
	{
		$q4=mysql_query("select name from fman_clubs where id=$a[id2];");
		$data2=mysql_fetch_array($q4);
		echo"<a href='club.php?id=$a[id2]'>$data2[name]</a>";
	}
	else
		echo"нет клуба (игрок уволен)";}
	echo"</div>";
}
if ($total > $kmess) 
{
	echo '<div class="topmenu">' . functions::display_pagination('news.php?act='.$act.'&amp;id='.$id.'&amp;', $start, $total, $kmess) . '</div>' .
	'<form action="news.php?act='.$act.'&amp;id='.$id.'" method="post"><p>' .
	'<input type="text" name="page" size="2"/>' .
	'<input type="submit" value="' . $lng['to_page'] . ' &gt;&gt;"/>' .
	'</p></form>';
}
echo '<div class="bmenu">Всего: ' . $total . '</div>';
echo"<div class='phdr'>";
if($id)echo"<a href='club.php?id=$id'>$t[name]</a><br/>";
echo"<a href='index.php'>Фут.менеджер</a></div>";
require_once("../incfiles/end.php"); 
?>
