Exemplo n.º 1
0
$rows = querySQL('db_outlet_info');
if ($rows) {
    foreach ($rows as $key => $value) {
        $_SESSION['selOutlet'][$key] = $value;
    }
}
// ** set configuration
include '../config/config.inc.php';
//prepare selected Date
list($sy, $sm, $sd) = explode("-", $_SESSION['selectedDate']);
// get outlet maximum capacity
$maxC = maxCapacity();
// get Pax by timeslot
$resbyTime = reservationsByTime('pax');
$tblbyTime = reservationsByTime('tbl');
$_SESSION['passbyTime'] = reservationsByTime('pass');
// get availability by timeslot
$availability = getAvailability($resbyTime, $general['timeintervall']);
$tbl_availability = getAvailability($tblbyTime, $general['timeintervall']);
// some constants
$outlet_name = querySQL('db_outlet');
// translate to selected language
$_SESSION['language'] = $language;
translateSite(substr($language, 0, 2), '../web/');
?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<html lang="<?php 
echo $language;
Exemplo n.º 2
0
<?
// get outlet maximum capacity
$maxC = maxCapacity();
// get Pax by timeslot
$passbyTime = reservationsByTime('pass');

// Maitre day comment
if (trim($maitre['maitre_comment_day']) != "" && $_SESSION['page'] == 2 ) {
	echo "<div class='alert_error'>
	<p class='center margin-bottom-10'><img src='images/icon_info.png' alt='error' class='middle'/>";
		// maitre comment
		echo $maitre['maitre_comment_day']."<br>";
	echo "</p></div>";
	$maitre['maitre_comment_day'] = '';	
}

// Max passerby warning
if (isset($passbyTime) && $_SESSION['passerby_max_pax'] > 0) {
	$i=1;
	foreach ($passbyTime as $key => $value) {
		if ( $_SESSION['passerby_max_pax']-$value <= 0 && $_SESSION['page'] == 2 ) {
			if($i<=1){echo "<div class='alert_warning'><p>";}
			echo "<img src='images/icon_warning.png' alt='error' class='middle'/>".formatTime($key,$general['timeformat']).": "._sentence_16."<br>";
			if($i==count($passbyTime)){echo "</p></div>";}
			$i++;
		}
	}
}

// Messages
if (count($_SESSION['messages']) > 0) {
Exemplo n.º 3
0
function processBooking()
{
    // rather than recursively calling query, insert all rows with one query
    global $general;
    // database table to store reservations
    $table = 'reservations';
    // reservation date
    $reservation_date = $_SESSION['selectedDate'];
    // prepare POST data for storage in database:
    // $keys
    // $values
    if ($_POST['action'] == 'submit') {
        $keys = array();
        $values = array();
        $i = 1;
        // prepare arrays for database query
        foreach ($_POST as $key => $value) {
            if ($key != "action" && $key != "dbdate" && $key != "reservation_date" && $key != "recurring_dbdate" && $key != "captcha" && $key != "barrier" && $key != "reservation_author" && $key != "email_type" && $key != "captchaField1" && $key != "captchaField2" && $key != "captchaField3") {
                $keys[$i] = $key;
                $values[$i] = "'" . $value . "'";
            }
            // remember some values
            if ($key == "reservation_date") {
                $reservation_date = strtotime($value);
            } else {
                if ($key == 'reservation_booker_name') {
                    $_SESSION['author'] = $value;
                } else {
                    if ($key == 'reservation_time') {
                        $_SESSION['reservation_time'] = "'" . $value . "'";
                    } else {
                        if ($key == 'reservation_pax') {
                            $_SESSION['reservation_pax'] = "'" . $value . "'";
                        }
                    }
                }
            }
            if ($key == "reservation_date") {
                $keys[$i] = $key;
                $values[$i] = "'" . $_SESSION['selectedDate'] . "'";
            }
            $i++;
        }
        // END foreach $_POST
        // =-=-=-=Store in database =-=-=-=-=-=-=-=-=-=-=-=-=-=-=
        // clear old booking number
        $_SESSION['booking_number'] = '';
        // variables
        $res_pax = $_POST['reservation_pax'] ? (int) $_POST['reservation_pax'] : 0;
        // sanitize old booking numbers
        $clr = querySQL('sanitize_unique_id');
        // create and store booking number
        if (!$_POST['reservation_id'] || $_POST['reservation_id'] == '') {
            $_SESSION['booking_number'] = uniqueBookingnumber();
            //$_SESSION['messages'][] = _booknum.":&nbsp;&nbsp;' ".$_SESSION['booking_number']." '";
            $keys[] = 'reservation_bookingnumber';
            $values[] = "'" . $_SESSION['booking_number'] . "'";
        }
        // =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
        // enter into database
        // =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
        // build new reservation date
        $index = array_search('reservation_date', $keys);
        // build for availability calculation
        $index = array_search('reservation_wait', $keys);
        if ($index) {
            $values[$index] = '1';
            $waitlist = '1';
        }
        //Check Availability
        // =-=-=-=-=-=-=-=-=
        // get Pax by timeslot
        $resbyTime = reservationsByTime('pax');
        $tblbyTime = reservationsByTime('tbl');
        // get availability by timeslot
        $occupancy = getAvailability($resbyTime, $general['timeintervall']);
        $tbl_occupancy = getAvailability($tblbyTime, $general['timeintervall']);
        //cut both " ' " from reservation_pax
        $res_pax = substr($_SESSION['reservation_pax'], 0, -1);
        $res_pax = substr($_SESSION['reservation_pax'], 1);
        $startvalue = $_SESSION['reservation_time'];
        //cut both " ' " from reservation_time
        $startvalue = substr($startvalue, 0, -1);
        $startvalue = substr($startvalue, 1);
        $val_capacity = $_SESSION['outlet_max_capacity'] - $occupancy[$startvalue];
        $tbl_capacity = $_SESSION['outlet_max_tables'] - $tbl_occupancy[$startvalue];
        if ((int) $res_pax > $val_capacity || $tbl_capacity < 1) {
            //prevent double entry
            $index = array_search('reservation_wait', $keys);
            if ($index > 0) {
                $values[$index] = '1';
                // = waitlist
                $waitlist = '1';
            } else {
                // error on new entry
                $keys[] = 'reservation_wait';
                $values[] = '1';
                // = waitlist
                $waitlist = '1';
            }
        }
        // END Availability
        if ($waitlist != 1) {
            // number of database fields
            $max_keys = count($keys);
            // enter into database
            // -----
            $query = "INSERT INTO `{$table}` (" . implode(',', $keys) . ") VALUES (" . implode(',', $values) . ") ON DUPLICATE KEY UPDATE ";
            // Build 'on duplicate' query
            for ($i = 1; $i <= $max_keys; $i++) {
                if ($keys[$i] != '') {
                    $query .= $keys[$i] . "=" . $values[$i] . ",";
                } else {
                    $max_keys++;
                }
            }
            // run sql query
            $query = substr($query, 0, -1);
            $result = query($query);
            $_SESSION['result'] = $result;
            // Reservation ID
            $resID = mysql_insert_id();
            // *** send confirmation email
            if ($_POST['email_type'] != 'no') {
                include '../web/classes/email.class.php';
            }
            // store new reservation in history
            $result = query("INSERT INTO `res_history` (reservation_id,author) VALUES ('%d','%s')", $resID, $_SESSION['author']);
            // Reservation was done
            $waitlist = 2;
        }
        // reservation done, handle back waitlist status
        return $waitlist;
    }
}
Exemplo n.º 4
0
<ul class="timeline">

<?php 
// get Pax by timeslot
$resbyTime = reservationsByTime('pax');
$tblbyTime = reservationsByTime('tbl');
// get availability by timeslot
$availability = getAvailability($resbyTime, $general['timeintervall']);
$tbl_availability = getAvailability($tblbyTime, $general['timeintervall']);
// ERROR REPORTING
/*
echo $_SESSION['outlet_max_capacity']."->".$_SESSION['outlet_max_tables']."<br>";
echo"<pre>";
print_r($resbyTime)."<br><br>";
print_r($tblbyTime)."<br><br>";
print_r($availability)."<br><br>";
print_r($tbl_availability);
echo"</pre>";
*/
// actual time rounded half hour
$round_numerator = 60 * $general['timeintervall'];
// 60 seconds per minute * 15 minutes equals 900 seconds
$rounded_time = round(time() / $round_numerator) * $round_numerator;
//timeline open/close time
//prevent 'division by zero error'
$open_time = $_SESSION['selOutlet']['outlet_open_time'] != "" ? $_SESSION['selOutlet']['outlet_open_time'] : "11:00:00";
$close_time = $_SESSION['selOutlet']['outlet_close_time'] != "" ? $_SESSION['selOutlet']['outlet_close_time'] : "22:00:00";
// calculate after midnight
$day = date("d");
$endday = $open_time < $close_time ? date("d") : date("d") + 1;
// build time values
Exemplo n.º 5
0
<?
// initialize
$count_slots = 0;
$val_by_time = 0;

// get Pax by timeslot
$resbyTime = reservationsByTime('pax');

// get availability by timeslot
$availability = getAvailability($resbyTime,$general['timeintervall']);

// actual time rounded half hour  
$round_numerator = 60 * $general['timeintervall']; // 60 seconds per minute * 15 minutes equals 900 seconds
$rounded_time = ( round ( time() / $round_numerator ) * $round_numerator );

//timeline open/close time
//prevent 'division by zero error'
$open_time = ($_SESSION['selOutlet']['outlet_open_time']!="") ? $_SESSION['selOutlet']['outlet_open_time'] : "11:00:00";
$close_time = ($_SESSION['selOutlet']['outlet_close_time']!="") ? $_SESSION['selOutlet']['outlet_close_time'] : "22:00:00";

// calculate after midnight
$day    = date("d");
$endday = ($open_time < $close_time) ? date("d") : date("d")+1;

// build time values
list($h1,$m1)		= explode(":",$open_time);
list($h2,$m2)		= explode(":",$close_time);
$value  			= mktime($h1+0,$m1+0,0,date("m"),$day,date("Y"));
$endtime		 	= mktime($h2+0,$m2+0,0,date("m"),$endday,date("Y"));
$i 					= 1;
// build break times UNIX time
Exemplo n.º 6
0
    $_SESSION['property'] = (int) $_POST['prp'];
}
// selected date
if ($_GET['selectedDate']) {
    $_SESSION['selectedDate'] = $_GET['selectedDate'];
} elseif ($_POST['selectedDate']) {
    $_SESSION['selectedDate'] = $_POST['selectedDate'];
} elseif ($_POST['dbdate']) {
    $_SESSION['selectedDate'] = $_POST['dbdate'];
} elseif (!$_SESSION['selectedDate']) {
    //$_SESSION['selectedDate'] = date('Y-m-d');
}
//prepare selected Date
list($sy, $sm, $sd) = explode("-", $_SESSION['selectedDate']);
// get Pax by timeslot
$resbyTime = reservationsByTime();
// get availability by timeslot
$availability = getAvailability($resbyTime, $general['timeintervall']);
// some constants
$bookingdate = date($general['dateformat'], strtotime($_POST['dbdate']));
$bookingtime = formatTime($_POST['reservation_time'], $general['timeformat']);
$outlet_name = querySQL('db_outlet');
//$_SESSION['booking_number'] = '';
//The subject of the confirmation email
$subject = $lang["email_subject"] . " " . $outlet_name;
//Email address of the confirmation email
$mailTo = $_POST['reservation_guest_email'];
?>

<!DOCTYPE html>
<html lang="<?php