Esempio n. 1
0
        $requestedCustomer = $customers[$_GET['customer']];
        ?>
                  <div class="panel panel-danger">
                    <?php 
        displayHeader($requestedCustomer);
        ?>
                    <table class="table">
                      <tr>
                        <th></th>
                        <th>ISBN</th>
                        <th>Title</th>
                        <th>Category</th>
                      </tr>
                     <?php 
        $orders = readOrders();
        displayOrders($orders, $requestedCustomer);
        ?>
                     </table>
                  </div>
         <?php 
    }
}
?>
      </div>

      </div>  <!-- end main content column -->
   </div>  <!-- end main content row -->
</div>   <!-- end container -->

 <script src="bootstrap/assets/js/jquery.js"></script>
 <script src="bootstrap/dist/js/bootstrap.min.js"></script>
Esempio n. 2
0
function render_body()
{
    if ($_GET['action'] == 'pridej-objednavku') {
        echo '
		<form action="objednavky.php?action=pridej-objednavku2" method="POST">
			<select name="stul">
				' . getTables() . '
			</select> Stul<br />
			Jidlo<br />
			<select name="jidlo">
				' . getFood() . '
			</select>
			<input type="text" name="mnozstvi" size="3" value="1">x pocet kusu<br />
			<input type="submit" value="Pridej jidlo">
		</form>';
    } elseif ($_GET['action'] == 'pridej-objednavku2') {
        if (is_numeric($_POST['mnozstvi'])) {
            $jidlo = MyDB::getInstance()->getResults('SELECT * FROM jidelni_listek WHERE id = ' . MyDB::escape($_POST['jidlo']));
            $cena = $jidlo[0]['cena'];
            for ($i = 1; $i <= $_POST['mnozstvi']; $i++) {
                MyDB::getInstance()->exec('INSERT INTO objednavka ("id_jidla","id_stolu","datum","cena") VALUES (' . MyDB::escape($_POST['jidlo']) . ', ' . MyDB::escape($_POST['stul']) . ', DATETIME("now"), "' . $cena . '")');
                //echo 'INSERT INTO objednavka ("id_jidla","id_stolu","datum","cena") VALUES ('.MyDB::escape($_POST['jidlo']).', '.MyDB::escape($_POST['stul']).', DATETIME("now"), "'.$cena.'")';
            }
            echo '<meta http-equiv="refresh" content="0;URL=\'objednavky.php\'">';
        } else {
            echo 'Zadejte platné množství!';
        }
    } elseif ($_GET['action'] == 'zaplatit') {
        MyDB::getInstance()->exec('UPDATE objednavka SET zaplaceno = 1 WHERE id = ' . MyDB::escape($_GET['id']));
        echo '<meta http-equiv="refresh" content="0;URL=\'objednavky.php\'">';
    } elseif ($_GET['action'] == 'zrusit') {
        MyDB::getInstance()->exec('DELETE FROM objednavka WHERE id = ' . MyDB::escape($_GET['id']));
        echo '<meta http-equiv="refresh" content="0;URL=\'objednavky.php\'">';
    } else {
        return '
	    <h1>Nezaplacené objednávky</h1>
	    <table class="datatable">
	    	<thead>
	    		<tr>
	    			<th>Stůl (salónek)</th>
	    			<th>Jídlo</th>
	    			<th>Čas</th>
	    			<th>Cena</th>
	    			<th>Možnosti</th>
	    		</tr>
	    	</thead>
	    	<tbody>
	    		' . displayOrders('neplacene') . '
	    	</tbody>
	    </table>

	    <br /><br />
		<p><a href="objednavky.php?action=pridej-objednavku"><img src="images/add.png" />Pridej jidlo</a></p>

		<h1>Zaplacené objednávky</h1>
		<table class="datatable">
	    	<thead>
	    		<tr>
	    			<th>Stůl (salónek)</th>
	    			<th>Jídlo</th>
	    			<th>Čas</th>
	    			<th>Cena</th>
	    			<th>Možnosti</th>
	    		</tr>
	    	</thead>
	    	<tbody>
	    		' . displayOrders('placene') . '
	    	</tbody>
	    </table>
	    ';
    }
}