<?php header('Content-type: text/html; charset=utf-8'); ?>
<?php
  require_once "/home/jeftay6/vinsbalthazard.com/cmsAdmin/lib/viewer_functions.php";

  list($productsRecords, $productsMetaData) = getRecords(array(
    'tableName'   => 'products',
  ));
  $productsRecord = @$productsRecords[0];

  list($listes_de_produitsRecords, $listes_de_produitsMetaData) = getRecords(array(
    'tableName'   => 'listes_de_produits',
  ));
  $listes_de_produitsRecord = @$listes_de_produitsRecords[0];
  
  list($winesRecords, $winesMetaData) = getRecords(array(
    'tableName'   => 'wines',
	
  ));
  list($producersRecords, $producersMetaData) = getRecords(array(
    'tableName'   => 'producers',
  ));
  
  list($yearRecords, $yearMetaData) = getRecords(array(
    'tableName'   => 'year',
  ));
  
  list($cepageRecords, $cepageMetaData) = getRecords(array(
    'tableName'   => 'cepage',
  ));
  
  list($countryRecords, $countryMetaData) = getRecords(array(
    'tableName'   => 'country',
  ));
  
  list($regionRecords, $regionMetaData) = getRecords(array(
    'tableName'   => 'region',
  ));
  
  $page = 'produits'; 

?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title><?php echo $productsRecord['page_title'] ?></title>
<meta name="Description" content="<?php echo $productsRecord['meta_description'] ?>" />
<meta name="KeyWords" content="<?php echo $productsRecord['meta_keywords'] ?>" />
<link rel="shortcut icon" href="/images/balthazard.ico">
<link rel="stylesheet" href="/css/style.css" type="text/css" media="screen" />
</head>

<body class="<?php echo $page ?> vin">
<div id="wrap">
	<?php include ($_SERVER['DOCUMENT_ROOT'] . '/includes/header.php'); ?>  	
    <div id="homemain">
        <h1><?php echo $productsRecord['title_fr'] ?></h1>
        <?php echo $productsRecord['content_fr'] ?>        
    </div>
    <div id="column">
        <div id="follow">
            <h5>Inscription infolettre</h5>
            <p class="nomargin">Lorem ipsum dolor sit amet, consectetur adipiscing elit. In metus nulla, tincidunt eu condimentum eget, vestibulum.</p>
            <iframe height="50" allowTransparency="true" frameborder="0" scrolling="no" style="width:100%;border:none" src="/machform/embed.php?id=1" title="Inscription Newsletter"></iframe>
            <?php include ($_SERVER['DOCUMENT_ROOT'] . '/includes/listeproduits.php'); ?>
            <br /><br />
        </div>
    </div><!-- column end -->
    <div class="searchdropdown">
    <select name="producteurs" style="width:200px;" onchange="window.location=this.options[this.selectedIndex].value;">
        <option value="0" selected="selected">--- Producteur ---</option>
        <?php foreach ($producersRecords  as $record): ?>
        <option value="/produits.php?producer=<?php echo $record['name'] ?>"><?php echo $record['name'] ?></option>
        <?php endforeach ?>
    </select>
     <select name="pays" style="width:150px;" onchange="window.location=this.options[this.selectedIndex].value;">
     	<option value="0" selected="selected">--- Pays ---</option>
        <?php foreach ($countryRecords  as $record): ?>
        <option value="/produits.php?country=<?php echo $record['title'] ?>"><?php echo $record['title'] ?></option>
        <?php endforeach ?>
     </select>
     <select name="region" style="width:200px;" onchange="window.location=this.options[this.selectedIndex].value;">
     	<option value="0" selected="selected">--- Region ---</option>
        <?php foreach ($regionRecords  as $record): ?>
        <option value="/produits.php?region=<?php echo $record['title'] ?>"><?php echo $record['title'] ?></option>
        <?php endforeach ?>
     </select>
     <select name="cepage" style="width:200px;" onchange="window.location=this.options[this.selectedIndex].value;">
     	<option value="0" selected="selected">--- Cepage ---</option>
        <?php foreach ($cepageRecords as $record): ?>
        <option value="/produits.php?cepage=<?php echo $record['title'] ?>"><?php echo $record['title'] ?></option>
        <?php endforeach ?>
     </select> 
     <select name="millesime" style="width:150px;" onchange="window.location=this.options[this.selectedIndex].value;">
     	<option value="0" selected="selected">--- Millesime ---</option>
        <?php foreach ($yearRecords as $record): ?>
        <option value="/produits.php?year=<?php echo $record['title'] ?>"><?php echo $record['title'] ?></option>
        <?php endforeach ?>
     </select>
    </div>
    <div id="searchwine">
    	<?php echo $productsRecord['search_wine_text_fr'] ?>	
    </div>
    <div class="searchdropdown">
    
    </div>
    <table width="100%" border="0">
      <tr>
        <th width="42">&nbsp;</th>
        <th width="197">Producteur</th>
        <th width="146">Vins</th>
        <th width="113">Region</th>
        <th width="133">Millesime</th>
        <th width="207">Appellation</th>
        <th>&nbsp;</th>
      </tr>
      <?php foreach ($winesRecords as $record): ?>
      <tr>      	
        <td class="<?php if ($record['couleur'] == 'Blanc'): ?>white<?php endif; ?><?php if ($record['couleur'] == 'Rouge'): ?>red<?php endif; ?><?php if ($record['couleur'] == 'Rosee'): ?>rosee<?php endif; ?>">&nbsp;</td>
        <td><?php echo $record['producer'] ?></td>
        <td><?php echo $record['page_title'] ?></td>
        <td><?php echo $record['country'] ?></td>
        <td><?php echo $record['year'] ?></td>
        <td><?php echo $record['origin'] ?></td>
        <td><a href="<?php echo $record['_link'] ?>"><img src="/images/more.png" width="95" height="28" alt="Voir vin"/></a></td>        
      </tr>
      <?php endforeach ?>
    </table>    
    <?php include ($_SERVER['DOCUMENT_ROOT'] . '/includes/footer.php'); ?>    
</div> <!-- wrap end -->
</body>
</html>