<?php
	//session_start();
  $thisPage="login";
  include __DIR__ . "./../layout/header.php";
  include __DIR__ . "./../layout/css/navi.css";
  //include __DIR__ . "./../layout/navigation.php";

//echo "<br><br><br>";

//$user = check_user();

//$all_users = $this->usersRepository->allUserNames();

//$user = $this->usersRepository->findByUserName($username); // user aus db
//$user_seite = $user['seite'];		// in der db eingetragene seite

//var_dump ($users); echo "<br><br>";
//echo $id = $user['id'];
//echo "<br>";
//var_dump ($user);
//echo "<br>".$id."<br>";	//.$user['password'];
//die();
//$user = check_user();
//if (isset($user)) { $id = $user['id']; }
//$_SESSION['id'] = $id;  ?>

<div class="container main-container">
	<h1>Einstellungen</h1><?php
	if (isset($success_msg) && !empty($success_msg)): ?>
		<div class="alert alert-success">
			<a href="#" class="close" data-dismiss="alert" aria-label="close">&times;</a>
		  	<?php echo $success_msg; ?>
		</div> <?php
	endif;

	if (isset($error_msg) && !empty($error_msg)): ?>
		<div class="alert alert-danger">
			<a href="#" class="close" data-dismiss="alert" aria-label="close">&times;</a>
	  		<?php echo $error_msg; ?>
		</div> <?php
	endif; ?>

	<!-- Nav tabs -->
	<div>
	  <ul class="nav nav-tabs" role="tablist">
	    <li role="presentation" class="active"><a href="#data" aria-controls="home" role="tab" data-toggle="tab">Persönliche Daten</a></li>
	    <li role="presentation"><a href="#email" aria-controls="profile" role="tab" data-toggle="tab">E-Mail</a></li>
	    <li role="presentation"><a href="#passwort" aria-controls="messages" role="tab" data-toggle="tab">Passwort</a></li>
	  </ul>
	  <!-- Persönliche Daten-->
	  <div class="tab-content">
	    <div role="tabpanel" class="tab-pane active" id="data">
	    	<br>
	    	<form action="?save=personal_data" method="post" class="form-horizontal">
	    		<div class="form-group">
	    			<label for="inputVorname" class="col-sm-2 control-label">Vorname</label>
	    			<div class="col-sm-10">
	    				<input class="form-control" id="inputVorname" name="vorname" type="text"
								value="<?php echo htmlentities($user['vorname']); ?>" required>
	    			</div>
	    		</div>

	    		<div class="form-group">
	    			<label for="inputNachname" class="col-sm-2 control-label">Nachname</label>
	    			<div class="col-sm-10">
	    				<input class="form-control" id="inputNachname" name="nachname" type="text"
								value="<?php echo htmlentities($user['nachname']); ?>" required>
	    			</div>
	    		</div>
					<div class="form-group">
	    			<label for="inputNachname" class="col-sm-2 control-label">id</label>
	    			<div class="col-sm-10">
	    				<input class="form-control" id="inputNachname" name="id" type="text"
								value="<?php echo htmlentities($user['id']);?>" required>
	    			</div>
	    		</div>

	    		<div class="form-group">
				    <div class="col-sm-offset-2 col-sm-10">
				      <button type="submit" class="btn btn-primary">Speichern</button>
				    </div>
				</div>
	    	</form>
	    </div>

	    <!-- Änderung der E-Mail-Adresse -->
	    <div role="tabpanel" class="tab-pane" id="email">
	    	<br>
	    	<p>Zum Änderen deiner E-Mail-Adresse gib bitte dein aktuelles Passwort sowie die neue E-Mail-Adresse ein.</p>
	    	<form action="?save=email" method="post" class="form-horizontal">
	    		<div class="form-group">
	    			<label for="inputPasswort" class="col-sm-2 control-label">Passwort</label>
	    			<div class="col-sm-10">
	    				<input class="form-control" id="inputPasswort" name="passwort" type="password" required>
	    			</div>
	    		</div>

	    		<div class="form-group">
	    			<label for="inputEmail" class="col-sm-2 control-label">E-Mail</label>
	    			<div class="col-sm-10">
	    				<input class="form-control" id="inputEmail" name="email" type="email"
								value="<?php echo htmlentities($user['email']); ?>" required>
	    			</div>
	    		</div>

	    		<div class="form-group">
	    			<label for="inputEmail2" class="col-sm-2 control-label">E-Mail (wiederholen)</label>
	    			<div class="col-sm-10">
	    				<input class="form-control" id="inputEmail2" name="email2" type="email"  required>
	    			</div>
	    		</div>

          <div class="form-group">
            <label for="inputID" class="col-sm-2 control-label">id</label>
            <div class="col-sm-10">
              <input class="form-control" id="inputID" name="id" type="text"
                value="<?php echo htmlentities($user['id']);?>" required>
            </div>
          </div>

	    		<div class="form-group">
				    <div class="col-sm-offset-2 col-sm-10">
				      <button type="submit" class="btn btn-primary">Speichern</button>
				    </div>
				</div>
	    	</form>
	    </div>

	    <!-- Änderung des Passworts -->
	    <div role="tabpanel" class="tab-pane" id="passwort">
	    	<br>
	    	<p>Zum Änderen deines Passworts gib bitte dein aktuelles Passwort sowie das neue Passwort ein.</p>
	    	<form action="?save=passwort" method="post" class="form-horizontal">
	    		<div class="form-group">
	    			<label for="inputPasswort" class="col-sm-2 control-label">Altes Passwort</label>
	    			<div class="col-sm-10">
	    				<input class="form-control" id="inputPasswort" name="passwortAlt" type="password" required>
	    			</div>
	    		</div>

	    		<div class="form-group">
	    			<label for="inputPasswortNeu" class="col-sm-2 control-label">Neues Passwort</label>
	    			<div class="col-sm-10">
	    				<input class="form-control" id="inputPasswortNeu" name="passwortNeu" type="password" required>
	    			</div>
	    		</div>


	    		<div class="form-group">
	    			<label for="inputPasswortNeu2" class="col-sm-2 control-label">Neues Passwort (wiederholen)</label>
	    			<div class="col-sm-10">
	    				<input class="form-control" id="inputPasswortNeu2" name="passwortNeu2" type="password"  required>
	    			</div>
	    		</div>

          <div class="form-group">
            <label for="inputID" class="col-sm-2 control-label">id</label>
            <div class="col-sm-10">
              <input class="form-control" id="inputID" name="id" type="text"
                value="<?php echo htmlentities($user['id']);?>" required>
            </div>
          </div>

	    		<div class="form-group">
				    <div class="col-sm-offset-2 col-sm-10">
				      <button type="submit" class="btn btn-primary">Speichern</button>
				    </div>
				</div>
	    	</form>
	    </div>
	  </div>
	</div>
	<a class="btn btn-primary" href="login" role="button">zurück zur Übersicht</a>
</div>

    <!-- Bootstrap core JavaScript
    ================================================== -->
    <!-- Placed at the end of the document so the pages load faster -->
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
    <script>window.jQuery || document.write('<script src="../../assets/js/vendor/jquery.min.js"><\/script>')</script>
    <script src="js/bootstrap.min.js"></script>


	</div><?php
	include __DIR__ . "/../layout/footer.php";
	?>
