<?php

/**
 * Football Manager for JohnCMS
 * Список участников
 * @author Screamer
 */

$textl = 'Список участников';
require '../incfiles/head.php';
$total = mysql_result(mysql_query("SELECT COUNT(*) FROM `man_clubs` WHERE `uid` != '0' AND `umod` = '1'"), 0);
echo '<div class="phdr"><a href="?">Футбольный менеджер</a> | Список участников</div>';
if ($total > 0) {
	$query = mysql_query(
		"SELECT `man_clubs`.`id` AS `cid`, "
		. "`man_clubs`.`name` AS `cname`, "
		. "`man_clubs`.`country`, "
		. "`man_clubs`.`city`, "
		. "`users`.`id` AS `uid`, "
		. "`users`.`name` AS `nick` "
		. " FROM `man_clubs` "
		. "LEFT JOIN `users` ON `man_clubs`.`uid` = `users`.`id` "
		. "WHERE `man_clubs`.`uid` != 0 AND `man_clubs`.`umod` = '1' "
		. "ORDER BY `users`.`name` ASC "
		. "LIMIT " . $start . ", " . $kmess
	);
	$i = 0;
	while ($item = mysql_fetch_assoc($query)) {
		echo '<div class="list' . ($i % 2 ? '2' : '1') . '">'
			. '<a href="?act=club&amp;id=' . $item['cid'] . '">' . htmlentities($item['cname'], ENT_QUOTES, 'UTF-8') . '</a>'
			. '<div class="sub">'
			. 'Менеджер: <a href="' . core::$system_set['homeurl'] . '/users/profile.php?user=' . $item['uid'] . '">'
			. htmlentities($item['nick'], ENT_QUOTES, 'UTF-8') . '</a><br />'
			. 'Страна: ' . htmlentities($item['country'], ENT_QUOTES, 'UTF-8') . '<br />'
			. 'Город: ' . htmlentities($item['city'], ENT_QUOTES, 'UTF-8') . '</div>'
			. '</div>';
		$i++;
	}
} else {
	echo '<div class="menu">Список пуст</div>';
}
echo '<div class="phdr">Всего: ' . $total . '</div>'
	. ( $total > $kmess
		? '<div class="topmenu">' . Functions::display_pagination('?act=users&amp;', $start, $total, $kmess) . '</div>'
		: ''
	);
require '../incfiles/end.php';