Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- session_start();
- if (!isset($_SESSION["user"]))
- {
- header('Location: login.php');
- exit();
- }
- require("db.php");
- $select = "SELECT * FROM menu WHERE datum > ".strtotime("yesterday")." GROUP BY prevadzka, datum";
- ?>
- <!DOCTYPE html>
- <html>
- <head>
- <meta charset="UTF-8" />
- <title>Prehľad menu</title>
- <script type="text/javascript" src="https://code.jquery.com/jquery-1.11.0.min.js"></script>
- <script type="text/javascript" src="https://code.jquery.com/ui/1.10.3/jquery-ui.js"></script>
- <link rel="stylesheet" href="jquery-ui.min.css" />
- <link rel="stylesheet" href="datetimepicker.css" />
- <script>
- $(document).ready(function(){
- $("#new").button();
- $(".button").button();
- });
- </script>
- </head>
- <body>
- <h1>Prehľad menu</h1>
- <a href="new.php" id="new">Pridať nové</a>
- <table style="width:100%; text-align:center;">
- <thead>
- <tr>
- <th>Dátum</th>
- <th>Prevádzka</th>
- <th>PDF</th>
- <th>Vymazať</th>
- </tr>
- </thead>
- <tbody>
- <?php
- $prevazka = array(
- "1"=> "L.A. Finger Food, Bratislava",
- "2"=>"SantaFe Nové mesto",
- "3"=>"SantaFe Ružinov",
- );
- foreach ($pdo->query($select) as $row) {
- echo "<tr>";
- echo "<td>".date("d.m.Y",$row["datum"])."</td>";
- echo "<td>".$prevazka[$row["prevadzka"]]."</td>";
- echo "<td><a href=\"pdf/menu_".$row["prevadzka"]."_".date("d_m_Y",$row["datum"]).".pdf\" target=\"_blank\" class=\"button\">PDF</a></td>";
- echo "<td><a href=\"delete.php?id=".$row["id"]."\" class=\"button\">Vymazať</a></td>";
- echo "</tr>";
- }
- ?>
- </tbody>
- </table>
- <hr />
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement