<?php 
require_once("script/php/class_connection.php");
require_once("script/php/class_navigation.php");
require_once("script/php/class_footer.php");
require_once("script/php/phpmailer/class.phpmailer.php");

$db = new db_connection();
$navigation = new navigation();
$footer = new footer();

/*Rechnungsmail erstellen START*/
function send_mail($name, $mail_adress, $phone, $content)
{    
    $mail = new PHPMailer();

    $mail->CharSet = 'utf-8';
    $mail->IsHTML(true);
    $mail->From = $mail_adress; //Absenderadresse der Email setzen
    $mail->FromName = $name; //Name des Abenders setzen
    $mail->AddAddress("info@ulrichsubklew.de"); //Empfängeradresse setzen
    //$mail->AddBcc("StefanBeubl@gmx.de"); //NUR FÜR DIE ENTWICKLUNG !!!
    $mail->Subject = "Kontaktformular | www.ulrichsubklew.de"; //Betreff der Email setzen

    $mail->Body = "<p><strong>Name:</strong> ".$name."<br /><strong>Email:</strong> ".$mail_adress."<br /><strong>Telefon:</strong> ".$phone."</p><p>".nl2br($content)."</p>";
    
    $mail->Send();
}
/*Rechnungsmail erstellen ENDED*/                  


if(isset($_POST['send']))
{
    send_mail(htmlspecialchars($_POST['name']), htmlspecialchars($_POST['email']), htmlspecialchars($_POST['phone']), htmlspecialchars($_POST['content']));
}
?>
<!DOCTYPE html>
<html lang="de">
<head>
    <!-- Global site tag (gtag.js) - Google Analytics -->
    <script async src="https://www.googletagmanager.com/gtag/js?id=UA-109519315-1"></script>
    <script>
      window.dataLayer = window.dataLayer || [];
      function gtag(){dataLayer.push(arguments);}
      gtag('js', new Date());

      gtag('config', 'UA-109519315-1');
    </script>

    <title>Ulrich Subklew | Kontakt | 85354 Freising</title>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link rel="alternate" hreflang="de-DE" href="http://www.ulrichsubklew.de/kontakt.php"/>
    <link rel="stylesheet" href="script/css/w3.css"/>
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
</head>
<body>

<div class="w3-content" style="max-width:1400px">

    <!-- Navigation Start -->
    <?php
    foreach ($navigation->navigation_output($db) as $key => $value)
    {
        echo $value->html_content;
    }
    ?>
    <!-- Navigation Ended -->

    <header class="w3-display-container w3-wide" id="home">
        <img class="w3-image" src="media/image/header/kontakt.jpg" alt="Eine Hand auf einer Laptop Tastatur." width="1400" height="1060">
        <!-- Small -->
        <div class="w3-hide-medium w3-hide-large w3-display-bottomleft w3-white w3-opacity" style="width: 130px; height: 100px;">
            <p class="w3-display-middle" style="width: 100%; text-align: center; margin: 0; font-weight: 300;">Kontakt</p>
        </div>
        <!-- Medium -->
        <div class="w3-hide-small w3-hide-large w3-display-bottomleft w3-white w3-opacity" style="margin-left: 40px; width: 240px; height: 150px;">
            <p class="w3-xlarge w3-display-middle" style="width: 100%; text-align: center; margin: 0; font-weight: 300;">Kontakt</p>
        </div>
        <!-- Large -->
        <div class="w3-hide-small w3-hide-medium w3-display-bottomleft w3-white w3-opacity" style="margin-left: 40px; width: 290px; height: 200px;">
            <p class="w3-xxlarge w3-display-middle" style="width: 100%; text-align: center; margin: 0; font-weight: 300;">Kontakt</p>
        </div>
    </header>

    <div class="w3-padding-large">

        <div class="w3-row">
            <span class="w3-xlarge" style="height: 0; font-weight: 700; position: relative; top: 36px;"><i class="fa fa-stop" style="color: #253780; margin-left: -16px;"></i> </span>
            <div class="w3-container">
                <div class="w3-quarter" style="padding:0 8px;">
                    <img class="w3-image print" style="margin-top: 16px;" src="media/image/ulrich-subklew-praesentiert-sich.jpg" alt="Ulrich Subklew sitzt auf einen Stuhl." width="429" height="662"/>
                </div>
                <div class="w3-threequarter">
                    <div class="w3-half" style="padding:0 8px;">
                        <p>Wenn Sie weitere Fragen haben oder einen<br /> Termin ausmachen möchten, nehmen Sie bitte<br /> telefonisch oder per Mail Kontakt mit mir auf,<br /> ich werde mich zeitnah bei Ihnen melden.</p>
                        <p>Ulrich Subklew<br /> Psychologische Managementberatung<br /> Mauermayrstraße 6<br /> 85354 Freising</p>
                        <p>Tel. +49 8161 - 938165<br /> info@ulrichsubklew.de</p>
                    </div>    
                    <div class="w3-half" style="padding:0 8px;">
                        <p>Schreiben Sie mir gerne:</p>
        
                        <form method="post" action="kontakt.php">
                            <label>Name:</label>
                            <input class="w3-input w3-border w3-margin-bottom" type="text" name="name" placeholder="Name eingeben" required="required">                            
        
                            <label>E-Mail:</label>
                            <input class="w3-input w3-border w3-margin-bottom" type="email" name="email" placeholder="E-Mail-Adresse eingeben" required="required">
        
                            <label>Telefon:</label>
                            <input class="w3-input w3-border w3-margin-bottom" type="tel" name="phone" pattern="^[0-9\-\+\s\(\)]*$" placeholder="Telefonnummer eingeben" required="required">
        
                            <label>Nachricht:</label>
                            <textarea class="w3-input w3-border w3-margin-bottom" style="height: 150px;" name="content" placeholder="Nachricht eingeben" required="required"></textarea>
        
                            <input class="w3-btn w3-text-white" style="width: 150px; background-color: #253780;" name="send" type="submit" value="Senden">
                        </form>
                    </div>                            
                </div>
            </div>

        </div>
    </div>

    <!-- Footer Start -->
    <?php
    foreach ($footer->footer_output($db) as $key => $value)
    {
        echo $value->html_content;
    }
    ?>
    <!-- Footer Ended -->

</div>

<script>
function myFunction() {
    var x = document.getElementById("demo");
    if (x.className.indexOf("w3-show") == -1) {
        x.className += " w3-show";
    } else {
        x.className = x.className.replace(" w3-show", "");
    }
}
</script>

</body>
</html>