<?php header('Content-type: text/html; charset=utf-8'); ?>
<?php
  /* STEP 1: LOAD RECORDS - Copy this PHP code block near the TOP of your page */
  require_once "/var/www/vhosts/onsemobilisepourvous.com/httpdocs/client/caribbean_spirit_net/admin/lib/viewer_functions.php";

  list($produitsRecords, $produitsMetaData) = getRecords(array(
    'tableName'   => 'produits',
    'where'       => whereRecordNumberInUrl(1),
    'limit'       => '1',
	'allowSearch' => '0',
  ));

  
$recordNumbersArray = getListValues('produits', 'linkedPOI', $produitsRecord['linkedPOI']); 
$recordNumbersAsCSV = join(', ', $recordNumbersArray);  
if (!$recordNumbersAsCSV) { $recordNumbersAsCSV = "0"; }
   
  // load all records 
  list($point_dinteretRecords, $point_dinteretMetaData) = getRecords(array( 
    'tableName'   => 'point_dinteret', 
    'allowSearch' => '0', 
    'where'       => "num IN ($recordNumbersAsCSV)", 


  ));
$produitsRecord = @$produitsRecords[0]; // get first record
?>
<!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>
  <title></title>
  <meta http-equiv="Content-Type" content="text/html;charset=UTF-8" />
  <style type="text/css">
    body          { font-family: arial; }
    .instructions { border: 3px solid #000; background-color: #EEE; padding: 10px; text-align: left; margin: 25px}
  </style>
 </head>
<body>

  <!-- INSTRUCTIONS -->
    <div class="instructions">
      <xmp><?php print_r($produitsRecords); ?></xmp> 
    </div>
  <!-- /INSTRUCTIONS -->
  
  <!-- INSTRUCTIONS -->
    <div class="instructions">
      <xmp><?php print_r($point_dinteretRecords); ?></xmp> 
    </div>
  <!-- /INSTRUCTIONS -->

  <!-- STEP2: Display Records (Paste this where you want your records to be listed) -->
    <h1>PRODUITS - Detail Page Viewer</h1>
      Record Number: <?php echo $produitsRecord['num'] ?><br/>
      Nom du produit: <?php echo $produitsRecord['productname'] ?><br/>
      Lattitude: <?php echo $produitsRecord['lattitude'] ?><br/>
      Longitude: <?php echo $produitsRecord['longitude'] ?><br/>
      Points d'intérêt liés: <?php echo $produitsRecord['linkedPOI'] ?><br/>
      _link : <a href="<?php echo $produitsRecord['_link'] ?>"><?php echo $produitsRecord['_link'] ?></a><br/>


  <?php foreach ($point_dinteretRecords as $record): ?>
      Record Number: <?php echo $record['num'] ?><br/>
      icone: <?php echo $record['icone'] ?><br/>
      Longitude: <?php echo $record['longitude'] ?><br/>
      Lattitude: <?php echo $record['lattitude'] ?><br/>
      Titre: <?php echo $record['titre'] ?><br/>
      Description: <?php echo $record['description'] ?><br/>
    <?php endforeach; ?>
      <hr/>
    <?php if (!$produitsRecord): ?>
      No record found!<br/><br/>
    <?php endif ?>
  <!-- /STEP2: Display Records -->

  <a href="<?php echo $produitsMetaData['_listPage']; ?>">&lt;&lt; Back to list page</a> - 
  <a href="mailto:?subject=<?php echo thisPageUrl() ?>">Email this Page</a>
</body>
</html>
