Exemplo n.º 1
0
function get_shifts($day)
{
    try {
        //open the database
        $db = new PDO('sqlite:schedule.sqlite');
        $db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
        $query = $db->query("SELECT * FROM shifts WHERE date = '{$day}' ");
        foreach ($query as $row) {
            ////display id
            echo $row['start'];
            if (get_available(user(), $row['id']) == 0) {
                ?>
            <form method="post" action="index.php">
                <input type="hidden" name="shift" value="<?php 
                echo $row['id'];
                ?>
"/>
                <input type="hidden" name="date" value="<?php 
                echo $row['date'];
                ?>
"/>
                <input type="submit"/>
            </form>
            <?php 
            } else {
                echo "we're good";
            }
            echo "<br/>";
        }
        $db = NULL;
    } catch (PDOException $e) {
        print 'Exxxception : ' . $e->getMessage();
    }
}
Exemplo n.º 2
0
//---------------------------------------------------------------------------------------
//Initial 'index.php' for Reservation App testing purposes
?>
<BIG>FCWD Reservation Test Application</BIG>
<Form name = "Reservation" method = "POST" Action = "">
<br />Please furnish a date range:<br />
<pre>   Starting date: <input type = "Text" Value = "2012-07-01" name = "startdate"><input type = "Submit" Value = "Update"></pre>
<pre>   Ending date:   <input type = "Text" Value = "2012-07-30" name = "enddate"><input type = "Submit" Value = "Update"></pre><br />

<?php 
$startdate = $_POST['startdate'];
$enddate = $_POST['enddate'];
echo "Reservations for date range:  " . $startdate . " to " . $enddate;
echo "<br />";
echo "<br />";
$result = get_available($startdate, $enddate);
echo "Unit vacancy status:<br /><br />";
for ($i = 1; $i <= $units; $i++) {
    $g = $i - 72;
    if ($result[$i]) {
        if ($i < 73) {
            echo "Walleye " . $i . " - Reserved";
        }
        if ($i > 72) {
            echo "Guthrie " . $g . " - Reserved";
        }
    } else {
        if ($i < 73) {
            echo "Walleye " . $i . " -";
        }
        if ($i > 72) {
Exemplo n.º 3
0
function get_price($price, $diskont = 1, $in_order, $name, $in_stock)
{
    $available = get_available($in_order, $in_stock);
    if ($available > 0) {
        $get_diskont = diskont($diskont, $name, $available);
        return array(round($price * $get_diskont * $available, 2), round($price * $available, 2));
    } else {
        return array('Товара нет в наличии');
    }
}