<?php

  //JavaScript für die Bestätigungsmeldung
  echo
  "
    <script language=\"JavaScript\" type=\"text/javascript\">
    function SendMailConfirm(id)
    {
        check =  confirm(\"Datensatz mit der ID: \" + id  + \" per E-Mail versenden?\");
    
        if (check==true)
        {
            location.href = \"addons/send_pdf.php?uid=\"+ id;
        }
        else
        {
            return false;
        }
    
    }
    
    </script>";
  
  $mydb= new DB_MySQL('zeltlager','zeltlager','Z3ltlager3363','localhost');
 
  $sql = "SELECT a.uid, a.nachname, a.vorname, a.strasse, a.wohnort, s.step FROM AnmeldungAdressen a LEFT JOIN AnmeldungStatus s ON a.uid = s.uid WHERE s.step >= 11 ORDER BY a.nachname COLLATE latin1_german2_ci, a.vorname COLLATE latin1_german2_ci";
  $mydb->query($sql);

  $ResultCounter = $mydb->count() ; 
  
  echo "<div class=\"panel panel-default\"><div class=\"panel-body\">";
  echo "<div class=\"table-responsive\">";
  echo "<table class=\"table table-striped table-bordered table-hover\" id=\"dataTables-show\">";
  
  
  echo "<thead><tr><th>UID</th><th>Nachname</th><th>Vorname</th><th>PDF<br>anzeigen</th><th>PDF<br> neu erstellen</th><th>PDF<br> verschicken</th></tr></thead><tbody>\n";
  
   while ($row = $mydb->fetchRow())
   {  
   
    echo "<tr><td>" . $row['uid'] . "</td><td class=\"linieunten\">" . $row['nachname'] . "</td><td class=\"linieunten\">" . $row['vorname'] .  "</td><td class=\"linieunten\"><a href=\"/pdf/" . $row['uid'] .".pdf\" target=\"_blank\">show</a></td><td class=\"linieunten\"><a href=\"addons/create_pdf.php?uid=" . $row['uid'] ." \">recreate</a></td><td class=\"linieunten\"><a href=\"#\" onClick=\"SendMailConfirm('" . $row['uid'] ."')\">send</a></td></tr>\n";  
   
   }     
  
  echo "</tbody></table></div></div></div>";
  
  $mydb->disconnect();
 
?>
