<?php
/**
 * This file is part of 
 * pragmaMx - Web Content Management System.
 * Copyright by pragmaMx Developer Team - http://www.pragmamx.org
 *
 * pragmaMx is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * $Revision: 0.1 $
 * $Author: Olaf Herfurth $
 * $Date: 2009/01/14 $
 */
 
// Blockcache ermoeglichen
$mxblockcache = true;
// Modulname
$module_name = 'Contest';
// Link zum Modul einblenden 
$contestlink=0;

// maximale Breite des Bildes
$picmaxwidth=350;

defined('mxMainFileLoaded') or die('access denied');

mxGetLangfile($module_name);
			
global $prefix, $user_prefix, $bgcolor1, $bgcolor2, $bgcolor3, $txtcolor1, $txtcolor2;
include_once('modules/' . $module_name . '/inc/functions.php');
include_once('modules/' . $module_name . '/config.php');

$GOTOCONTEST=readCategoryBaseName();

$content="";
$result = sql_query("SELECT * FROM " . $prefix . "_pmxContest_contest WHERE published='1' and status='2' ORDER BY datum desc limit 1");		// . $limit . "");
		$result2 = sql_fetch_array($result) ;
		$cid=$result2['conid'];
		$title=$result2['cattitle'];
		$result3 = sql_query("SELECT * FROM " . $prefix . "_pmxContest_picture WHERE cid='".$cid."' and rank='1' ");
		$result4 = sql_fetch_array($result3) ;

		$content .= "<center><table width=\"".intval($picmaxwidth+50) ."\" border=\"0\" cellspacing=\"2\" cellpadding=\"2\" bgcolor=\"$bgcolor1\"><tr >";
		$content .="<td align=\"center\"><b>".$result4['user_name']."</b><br></td>";			//$title
		$content .="";
		$content .= "</tr>";
		


	  $content .=  "<td align=\"center\"><b><div style=\"text-indent: -8px; margin-left: 8px;\">";
	  $content .= "<a href=\"modules.php?name=" ;
	  $content .= $module_name . "&amp;pid=" . $cid . "\"><img src=\"" .$result4['pic_url']. "\"  width=\"$picmaxwidth\" /></a><br>";
	  $content .= "<br>".$result4['title']."<br>";   //"".$result4['name'].
	  $content .= "</td></tr>";
	  if ($contestlink==1) $content .= "<tr ><td align=center><p align='tiny'><a href='modules.php?name=".$module_name."'>[".$GOTOCONTEST."]</a></p></td></tr>";


	  $content .="</table></center>";
	  
$blockfiletitle = _BLOCK_LAST_WINNER . " : ".$title;
  
?>