Advertisement
DeMorgan

menuu.php

Jun 26th, 2015
208
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.64 KB | None | 0 0
  1. <?php
  2. session_start();
  3.    
  4. if (!isset($_SESSION["user"]))
  5. {
  6.     header('Location: login.php');
  7.     exit();
  8. }
  9.     require("db.php");
  10.     $select = "SELECT * FROM menu WHERE datum > ".strtotime("yesterday")." GROUP BY prevadzka, datum";
  11. ?>
  12. <!DOCTYPE html>
  13. <html>
  14.     <head>
  15.         <meta charset="UTF-8" />
  16.         <title>Prehľad menu</title>
  17.         <script type="text/javascript" src="https://code.jquery.com/jquery-1.11.0.min.js"></script>
  18.         <script type="text/javascript" src="https://code.jquery.com/ui/1.10.3/jquery-ui.js"></script>
  19.         <link rel="stylesheet" href="jquery-ui.min.css" />
  20.         <link rel="stylesheet" href="datetimepicker.css" />
  21.         <script>
  22.             $(document).ready(function(){
  23.                 $("#new").button();
  24.                 $(".button").button();
  25.             });
  26.         </script>
  27.     </head>
  28.     <body>
  29.         <h1>Prehľad menu</h1>
  30.         <a href="new.php" id="new">Pridať nové</a>
  31.         <table style="width:100%; text-align:center;">
  32.         <thead>
  33.             <tr>
  34.                 <th>Dátum</th>
  35.                 <th>Prevádzka</th>
  36.                 <th>PDF</th>
  37.                 <th>Vymazať</th>
  38.             </tr>
  39.         </thead>
  40.         <tbody>
  41.             <?php
  42.             $prevazka = array(
  43.                 "1"=> "L.A. Finger Food, Bratislava",
  44.                 "2"=>"SantaFe Nové mesto",
  45.                 "3"=>"SantaFe Ružinov",
  46.             );
  47.             foreach ($pdo->query($select) as $row) {
  48.                 echo "<tr>";
  49.                 echo "<td>".date("d.m.Y",$row["datum"])."</td>";
  50.                 echo "<td>".$prevazka[$row["prevadzka"]]."</td>";
  51.                 echo "<td><a href=\"pdf/menu_".$row["prevadzka"]."_".date("d_m_Y",$row["datum"]).".pdf\" target=\"_blank\" class=\"button\">PDF</a></td>";
  52.                 echo "<td><a href=\"delete.php?id=".$row["id"]."\" class=\"button\">Vymazať</a></td>";
  53.                 echo "</tr>";
  54.             }
  55.                
  56.             ?>
  57.         </tbody>
  58.         </table>
  59.         <hr />
  60.     </body>
  61. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement