2019-05-23 08:58:48 +02:00
|
|
|
<script src="/js/search.js" charset="utf-8"></script>
|
2019-05-19 18:37:00 +02:00
|
|
|
|
|
|
|
<div class="container mt-5 mb-5">
|
|
|
|
<h1>Rezepte</h1>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<a href="/new-recipe" class="btn btn-primary float-right">Neues Rezept</a>
|
|
|
|
|
|
|
|
<div class="input-group mb-3 w-50">
|
|
|
|
<div class="input-group-prepend">
|
|
|
|
<span class="input-group-text"><i class="fas fa-search"></i></span>
|
|
|
|
</div>
|
|
|
|
<input type="text" class="form-control" placeholder="suchen..." id="search-recipes">
|
|
|
|
<div class="input-group-append">
|
|
|
|
<button class="fas fa-times p-2 pl-3 pr-3 rounded-right border-0" id="clear-search-string"></button>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
<div class="container mb-4" id="recipes">
|
2018-10-24 15:00:27 +02:00
|
|
|
<?php
|
|
|
|
include $_SESSION["docroot"].'/php/classes.recipe.php';
|
|
|
|
$book = new cookbook;
|
|
|
|
|
|
|
|
$i=0;
|
|
|
|
$currentLetter = "";
|
|
|
|
foreach ($book->getRecipeNames() as $id => $name) {
|
2019-05-19 18:37:00 +02:00
|
|
|
$recipeEntryClass = "rounded-lg mt-1 p-1 pl-4 text-decoration-none font-weight-bold text-light";
|
|
|
|
if($i%2==0){$recipeEntryClass.=" bg-primary";}
|
|
|
|
else{$recipeEntryClass.=" bg-secondary";}
|
2018-10-24 15:00:27 +02:00
|
|
|
|
|
|
|
if((strtoupper(str_split($name)[0]))!=strtoupper($currentLetter)){
|
|
|
|
$currentLetter = strtoupper(str_split($name)[0]);
|
2019-05-19 18:37:00 +02:00
|
|
|
if($i!=0){
|
|
|
|
echo '</div>';
|
|
|
|
}
|
|
|
|
echo '<div class="container mt-5 d-flex flex-column">';
|
2018-10-24 15:00:27 +02:00
|
|
|
echo "<h2>".strtoupper($currentLetter)."</h2>";
|
|
|
|
}
|
2019-05-19 18:37:00 +02:00
|
|
|
echo "<a href='/recipe/$id' data-letter='$currentLetter' class='$recipeEntryClass'>$name</a>";
|
2018-10-24 15:00:27 +02:00
|
|
|
$i++;
|
|
|
|
}
|
|
|
|
?>
|
2019-05-19 18:37:00 +02:00
|
|
|
</div>
|