<?php
?>
<script>
    $('lh').DataTable({ lengthMenu: [[ 10, 25, 50, 100, -1],[ 10, 25, 50, 100, "Tout"]], pageLength: 10});
</script>
<!--    table table-condensed    -->
<div class="card" style="background-color: #B7A0A7; padding: 5px; box-shadow: 0px 0px 10px 3px #000; border-radius: 15px;">
 <div class="card-header" style="background-color: #776067; color: #F7F7F7; font-size: 1.8em; font-weith: bold; text-shadow: 1px 1px 4px #100; float: right; border-radius: 15px;">Liste des derniers entendus</div>
  <div class="table-responsive">
   <table id="lh" class="table table-condensed" data-page-length="10">
    <thead>
     <tr>
      <th>Heure (<?php echo TIMEZONE;?>)</th>
      <th>Indicatif</th>
      <th>Cible</th>
      <th>Passerelle</th>
      <th>Durée (s)</th>
     </tr>
    </thead>
    <tbody>

<?php
for ($i = 0; $i < count($lastHeard); $i++) {
		$listElem = $lastHeard[$i];
		echo"<tr style='background-color: #E7D0D7;'>";

		echo"<td>$listElem[0]</td>";
		
		if (defined("SHOWQRZ") && $listElem[1] !== "??????????" && !is_numeric($listElem[1])) {
		$extracted = preg_replace('/[-\/_].*/', '', $listElem[1]);
			echo"<td nowrap><a target=\"_new\" href=\"https://qrz.com/db/$extracted\">" . str_replace("0", "&Oslash;", $listElem[1]) . "</a></td>";
		} else {
			if (defined("GDPR"))
				echo"<td nowrap>".str_replace("0","&Oslash;",substr($listElem[1],0,3)."***")."</td>";
			else
				echo"<td nowrap>".str_replace("0","&Oslash;",$listElem[1])."</td>";
		}

		echo"<td>$listElem[2]</td>";

		if (defined("GDPR")) {
			echo"<td nowrap>".str_replace("0","&Oslash;",substr($listElem[3],0,3)."***")."</td>";
		} else {
			echo"<td nowrap>".str_replace("0","&Oslash;",$listElem[3])."</td>";
		}
		echo"<td>$listElem[4]</td>";

		echo"</tr>\n";
	}
?>
    </tbody>
   </table>
  </div>
  <script>
    $(document).ready(function(){
      $('#lh').dataTable( {
        "aaSorting": [[0,'desc']]
      } );
    });
  </script>
 </div>
</div>