<?php
/**
 * Module page - list_matchs
 *
 * Display calendar for form page.
 *
 * @package Setup
 * @author  Eric GALLENE <okrome@free.fr>
 * @link	http://www.phpcompet.com
 * @version $Id: modules/list_matchs.php,v 1.00 2006/12/06 18:15:00
 */

require_once './core/functions.php';

$club  = $_GET['club'];
$theme = $_GET['theme'];

$tpl    = split('::', $theme);
$style  = 'templates/'.$tpl[0].'/'.$tpl[1].'.css';


$SELECT1 = 'SELECT '.TBL_MATCHS.'.id, '.TBL_MATCHS.'.date_day, '.TBL_MATCHS.'.id_candidate_dom, C1.shortname AS domclub, C1.imgurl AS domimg, ST1.id AS stadium1_id, ST1.longname AS stadium1, 
			ST2.id AS stadium2_id, ST2.longname AS stadium2, '.TBL_MATCHS.'.id_candidate_ext, C2.shortname AS extclub, C2.imgurl AS extimg, D.day, CO.shortname, CO.id as competition, D.id_season as season
			FROM '.TBL_MATCHS.' 
			LEFT JOIN '.TBL_DAYS.' AS D ON '.TBL_MATCHS.'.id_day = D.id 
			JOIN '.TBL_COMPETITIONS.' AS CO ON D.id_compet = CO.id
			JOIN '.TBL_CLUBS.' AS C1 ON '.TBL_MATCHS.'.id_candidate_dom = C1.id 
			JOIN '.TBL_CLUBS.' AS C2 ON '.TBL_MATCHS.'.id_candidate_ext = C2.id
			LEFT JOIN '.TBL_STADIUMS.' AS ST1 ON ST1.id = '.TBL_MATCHS.'.id_stadium
			LEFT JOIN '.TBL_STADIUMS.' AS ST2 ON C1.id_stadium = ST2.id
			WHERE '.TBL_MATCHS.'.date_day  >= NOW() AND (C1.id = '.$club.' OR C2.id = '.$club.') ORDER BY '.TBL_MATCHS.'.date_day ASC LIMIT 1'; 
$res1   = runSQL($SELECT1);



$smarty->assign('match_preview', $res1[0]);
$smarty->assign('style', $style);
$smarty->display('./export_nextmatch.tpl');


?>