<?php
define('_IN_JOHNCMS', 1);
$headmod = 'manager';
$textl='Jamoa';
require_once("../incfiles/core.php");
require_once("../incfiles/head.php");
require_once("manfunc.php"); 

if(!$id && $club_id)$id=$club_id;

$dop=functions::check($_GET['dop']);

if($id==$club_id)echo"<div class='phdr'>Mening klubim</div>"; else echo"<div class='phdr'>Klub</div>";

$q=mysql_query("select * from fman_clubs where id='$id';");
$a=mysql_fetch_array($q);

echo"<div class='menu'><div align='center'><img src='emblems/$a[id].jpg' alt='$a[name]'/></div></div>
<div class='menu'>Nomi: <b>$a[name]</b></div>
<div class='menu'>Shahar: <b>$a[city]</b></div>
<div class='menu'>Mamlakat: ".land($a[land],'link')."</div>
<div class='menu'>Fanatlari: <b>$a[fan]</b></div>
<div class='menu'>Yutuq: <b>$a[win]</b></div>
<div class='menu'>Durrang: <b>$a[lose]</b></div>
<div class='menu'>Mag'lubiyat: <b>$a[draw]</b></div>";

$count_trans=mysql_result(mysql_query("select count(*) from fman_news where club_id=$id;"),0);
$count_trans_new=mysql_result(mysql_query("select count(*) from fman_news where club_id=$id and time>".($realtime-3600*48).";"),0);

if($id!=$club_id && $a[user_id])
{
	$qu=mysql_query("select * from users where id='$a[user_id]';");
	$udata=mysql_fetch_array($qu);
	echo"<div class='menu'>Меnejer: <a href='/users/profile.php?user=$a[user_id]'>$udata[name]</a>";
	if($a[u8])echo" (Klubni boshqarishni boshlagan vaqti ".functions::display_date($a[u8]).")";
	if($rights>=7 && $rights>$udata[rights])echo" [<a href='uvol.php?id=$a[id]'>bo`shatish</a>]";
	echo"</div>";
}
if($id==$club_id && $a[u8])echo"<div class='gmenu'>Jamoani boshqarishni boshlagan vaqtim ".functions::display_date($a[u8])."</div>";

if($id==$club_id && $rights<7 || $id==$club_id)echo"<div class='gmenu'>[<a href='uvol.php?id=$a[id]'>bo`shash</a>]</div>";

echo"<div class='phdr'><b>Jamoa</b></div>
<div class='menu'><a href='news.php?id=$id'>Klub jurnali</a> ($count_trans".($count_trans_new ? " <span class='red'>+$count_trans_new</span>" : '').")</div>
<div class='menu'><a href='list-of-players.php?id=$id'>O`yinchilar ro`yxati</a> (".count_players($id).")</div>";

if($club_id==$id)echo"<div class='menu'><a href='sostav.php'>Asosiy tarkibni boshqarish</a></div>";

echo"<div class='menu'>Turnir: ".land($a[land],'lig')."</a></div>";

$qra=mysql_query("select * from fman_clubs where id!=99 order by fan desc;");

$n=0;

while($ara=mysql_fetch_array($qra))
{
	$n=$n+1;
	if($ara[id]==$id)$nr=$n;
}
$npj=round($nr,-1);
if($npj<$nr)$npj=$npj+10;
$np=$npj/10;
echo"<div class='menu'><a href='rait.php?page=$np&amp;id=$id'>Klub fanatlari reytingida</a> ($nr o'rin 98)</div><div class='menu'><a href='matches.php?act=b&amp;id=$id'>Bo`lajak O`yinlar</a></div>
<div class='menu'><a href='matches.php?act=p&amp;id=$id'>So'nggi O`yinlar</a></div>
<div class='menu'><a href='finance.php?id=$id'>Moliya</a> (Buydjet: $".number_format($a[budj],0,'.',' ').")";
if($rights>=9 && $rights>$udata[rights])echo" [<a href='budj.php?id=$a[id]'>O`zgartirish</a>]";
echo"</div>";
echo"<div class='menu'><a href='trophy.php?id=$id'>Klub sovrinlari</a></div>";

echo" <div class='menu'>Stadioni: <a href='stad.php?id=$id'>$a[stadion]</a> (".number_format($a[stadv],0,'.',' ')." o'rin)</div>";
echo"<div class='menu'><a href='build.php?club=$id'>Klub qurilishi</a></div>";
echo"<div class='menu'><a href='spons.php?club=$id'>Klub homiyi</a></div>";
if($club_id && $club_id!=$id && $a[user_id])echo "<div class='phdr'>Harakat</div>
<div class='menu'><a href='tm.php?id=$id'>O`rtoqlik o`yiniga tak.qilish</a></div>";


echo"<div class='phdr'><a href='index.php?'>Futbol Menejer</a></div>";

require_once("../incfiles/end.php"); 
?>