template.php // die Ausgabe/Anzeige
Code:
<!--div class="container-fluid w-75"--> <div class="jumbotron"> <div class="card mt-5"> <div class="card-header text-light bg-info"> <h4>Users</h4> </div> <div class="card-body "> <form method="POST"> <div class="row "> <div class="input-group input-group-sm mb-3"> <span id="inputGroup-sizing-sm" ></span> <input type="varchar" class="form-control" name="first_name" placeholder="Vorname" value="<?=$this->first_name?>" aria-label="Sizing example input" aria-describedby="inputGroup-sizing-sm" required> </div> <div class="input-group input-group-sm mb-3"> <span id="inputGroup-sizing-sm"></span> <input type="varchar" class="form-control" name="last_name" placeholder="Nachname" value="<?=$this->last_name?>" aria-label="Sizing example input" aria-describedby="inputGroup-sizing-sm"> </div> <div class="input-group input-group-sm mb-3"> <span id="inputGroup-sizing-sm"></span> <input type="smallint" minlength="2" maxlength="3" class="form-control" name="corridor" placeholder="Flur" value="<?=$this->corridor?>" aria-label="Sizing example input" aria-describedby="inputGroup-sizing-sm" required maxlength="3"> </div> <div class="input-group input-group-sm mb-3"> <span id="inputGroup-sizing-sm"></span> <input type="smallint" minlength="2" maxlength="2" pattern="^[0-9]{2}$" class="form-control" name="room" placeholder="Zimmer" value="<?=$this->room?>" aria-label="Sizing example input" aria-describedby="inputGroup-sizing-sm" required> </div> <div class="input-group input-group-sm mb-3"> <span id="inputGroup-sizing-sm"></span> <input type="smallint" minlength="2" maxlength="2" pattern="^[0-9]{2}$" class="form-control" name="bed" placeholder="Bett" value="<?=$this->bed?>" aria-label="Sizing example input" aria-describedby="inputGroup-sizing-sm" required> <input type="checkbox" class="btn-check" id="proven" name="proven" value="1"> <label class="btn btn-outline-danger" for="proven">Belegt</label> </div><br> <div class="col-2 overflow-hidden "> <button type="submit" class="btn-sm btn-info ml-4 text-white" value="<?=$this->save_update?>" name="buttonUser"><?=$this->save_update?></button> </div> <input type="hidden" name="id" value="<?=$this->ID?>" > </div> </form> </div> </div> <!--INFO--> <h5 class="text-white"><?=$this->info?></h5> <div class="card mt-2"> <div class="card-header"> <form method="post"> <div class="input-group"> <input type="text" class="form-control btn-sm mt-3" name="search" placeholder="Suchen"> <div class="input-group-btn"> <button class="btn btn-info mt-3" type="submit" name="buttonUser" value="search"> <i class="fa fa-search text-white"></i> </button> </div> </div> </form> </div> <div class="card-body"> <table class="table table-striped "> <thead class="bg-secondary text-light"> <tr> <th scope="col">Uhrzeit / Datum</th> <th scope="col">Vorname</th> <th scope="col">Nachname</th> <th scope="col">Flur</th> <th scope="col">Zimmer</th> <th scope="col">Bett</th> <th scope="col">Belegt</th> <th scope="col" class=" d-flex justify-content-end pe-3">Aktionen</th> </tr> </thead> <?php foreach ($this->rows as $row) : ?> <tr class="t-row"> <?php // Convert the stored date and time to the desired format $dateTimeObject = new DateTime($row['datetime']); // Convert the string datetime to a DateTime object $formattedDate = $dateTimeObject->format('d.m.Y'); // Format the date as 25.12.2023 $formattedTime = $dateTimeObject->format('H:i'); // Format the time as 18:19 // + sec. :s // 18:19:20 ?> <td><?= $formattedTime ?> Uhr <?= $formattedDate ?></td> <td><?=htmlspecialchars($row['first_name'])?></td> <td><?=htmlspecialchars($row['last_name'])?></td> <td><?= sprintf('%02d', htmlspecialchars($row['corridor'])) ?></td> <!-- Führende Null für Flur --> <td><?= sprintf('%02d', htmlspecialchars($row['room'])) ?></td> <!-- Führende Null für Zimmer --> <td><?= sprintf('%02d', htmlspecialchars($row['bed'])) ?></td> <!-- Führende Null für Bett --> <td> <?php if ($row['proven'] == 1): ?> <input type="checkbox" class="btn-check" id="checkbox<?= $row['id'] ?>" checked disabled> <label class="btn btn-outline-danger btn-sm" for="checkbox<?= $row['id'] ?>">Belegt</label> <?php else: ?> <input type="checkbox" class="btn-check" id="checkbox<?= $row['id'] ?>" disabled> <label class="btn btn-outline-success btn-sm" for="checkbox<?= $row['id'] ?>">Frei</label> <?php endif; ?> </td> <td class="d-flex justify-content-end align-items-center" style="height: 50px;"> <form method="POST" > <input type="hidden" name="id" value="<?=$row['id']?>" > <button type="submit" class="btn btn-info text-white btn-sm mt-3" value="edit" name="buttonUser">Bearbeiten</button> <button type="submit" class="btn btn-danger ml-2 btn-sm mt-3" value="delete" name="buttonUser">Löschen</button> </form> </td> </tr> <?php endforeach ?> </table> </div> </div> </div> <!--/div--> <!--script type="module" src="/App/classes/user_mvc_class/template.js"></script-->
Comment