function churchresource_getCurrentBookings() { $txt = ""; if (user_access("view", "churchresource")) { include_once "churchresource_db.php"; // Alle buchungen ab jetzt bis morgen mit Status 2 $res = getBookings(0, 1, "2"); if ($res != null) { $arr = array(); $counter = 0; foreach ($res as $r) { $r->startdate = new DateTime($r->startdate); $r->enddate = new DateTime($r->enddate); $ds = getAllDatesWithRepeats($r, 0, 1); if ($ds != null) { foreach ($ds as $d) { $counter = $counter + 1; $a = array(); $a["realstart"] = new DateTime($d->format('Y-m-d H:i:s')); $a["startdate"] = $r->startdate; $a["enddate"] = $r->enddate; $a["person_name"] = $r->person_name; $a["resource_id"] = $r->resource_id; $a["repeat_id"] = $r->repeat_id; $a["text"] = $r->text; $a["id"] = $r->id; $arr[] = $a; } } } if ($arr != null) { $resources = churchcore_getTableData("cr_resource"); function cmp($a, $b) { if ($a["realstart"] == $b["realstart"]) { return 0; } else { if ($a["realstart"] > $b["realstart"]) { return 1; } else { -1; } } } usort($arr, "cmp"); foreach ($arr as $val) { $txt .= "<li><p><a href=\"?q=churchresource&id=" . $val["id"] . "\">" . $val["text"] . "</a> "; if ($val["repeat_id"] > 0) { $txt .= '<img title="Serie startet vom ' . $val["startdate"]->format('d.m.Y H:i') . '" src="' . CHURCHRESOURCE . '/images/recurring.png" width="16px"/> '; } $txt .= "(" . $resources[$val["resource_id"]]->bezeichnung . ")<br/><small>" . $val["realstart"]->format('d.m.Y H:i') . " " . $val["person_name"] . "</small><br/>"; } if ($txt != "") { $txt = "<ul>{$txt}</ul>"; } } } } return $txt; }
function testgetBookings($expectedresult, $idBabysitter) { echo "<h1>Running Get Bookings with Parameters:</h1>"; echo "idBabysitter = {$idBabysitter} <br />"; $result = getBookings($idBabysitter); echo "Expected Value is " . $expectedresult . ". Return value is " . $result; if ($result == $expectedresult) { echo '<p style="color:#008000"><b>Passed.</b></p>'; } else { echo '<p style="color:#800000"><b>Failed.</b></p>'; } }
exit; } $babysitterid = $_GET["bsid"]; $confirmedget = $_GET["confirmed"]; $idget = $_GET["id"]; $result = $mysqli->query("SELECT firstName, lastName FROM babysitters WHERE id = '{$babysitterid}'"); $row = $result->fetch_assoc(); $sittername = $row["firstName"] . " " . $row["lastName"]; echo "<h1>Confirm Bookings for {$sittername}</h1>"; if ($confirmedget == 1) { confirmBooking($idget); } if ($confirmedget == 0) { rejectBooking($idget); } $booking = getBookings($babysitterid); if ($booking === 0) { echo "<p>There are no bookings for this babysitter</p>"; exit; } //Create select query $bookings_query = "SELECT b.starttime, b.endtime, b.confirmed, b.id, p.firstName, p.lastName, s.rate FROM bookings b INNER JOIN babysitters s ON b.idBabysitter = s.id INNER JOIN parents p ON b.idParent = p.id WHERE s.id = '{$babysitterid}'"; echo '<br />' . '<table>' . '<tr>' . '<th>Parent</th>' . '<th>Date/Time</th>' . '<th>Hours</th>' . '<th>Pay</th>' . '<th>Status</th>' . '</tr>'; if ($stmt = $mysqli->prepare($bookings_query)) { $stmt->execute(); $stmt->store_result(); $stmt->bind_result($starttime, $endtime, $confirmed, $id, $firstName, $lastName, $rate); while ($stmt->fetch()) { $ustarttime = strtotime(str_replace('-', '/', $starttime)); $uendtime = strtotime(str_replace('-', '/', $endtime)); echo '<tr>' . '<td>' . $firstName . " " . $lastName . '</td>' . '<td>' . $starttime . '</td>' . '<td>' . getLength($ustarttime, $uendtime) . '</td>' . '<td>$' . number_format(getPay($rate, getLength($ustarttime, $uendtime)), 2) . '</td>' . '<td>';
<?php require_once '../setBackendPath.php'; require_once $backendPath . 'config.php'; require_once '../templates/twigController.php'; require_once 'commonWeb.php'; // check if valid booking if (!isset($_REQUEST['booking_number']) || !isset($_REQUEST['guest_email'])) { die("Access Denied"); } else { $booking_number = $_REQUEST['booking_number']; } $bookingDataArray = getBookings($booking_number); if (count($bookingDataArray) == 0) { die("Booking Number Not Valid"); } if ($_REQUEST['guest_email'] !== $bookingDataArray['client_contact_data']['email_address']) { die("Email Not Valid"); } // load conceirge options data $conciergeCategoriesData = loadSelectTree("services"); $preferencesData = loadSelectTree("services_internal"); // load or save file $jsonFilename = "conciergeRequest_" . $booking_number . ".json"; if (count($_POST) !== 0) { //save data $requestData = $_POST; foreach ($requestData as $key => $value) { //eliminates if no text or data is entered if (empty($value)) { unset($requestData[$key]);
<?php if (count($_POST) == 0) { $transactionResult = true; } else { $expirationMonth = date_parse($_POST['month'])['month']; $expirationYear = intval($_POST['year']); $cardNumber = $_POST['cardnumber']; $instance = new CreditCardController(35, $cardNumber, $expirationMonth, $expirationYear); $transactionResult = $instance->processSale(); } $transactionMsg = $transactionResult ? "" : ""; $twig = (new TwigController())->getTwigEnvironment(); $bookingDataArray = getBookings($_GET['booking_number']); $date = new DateTime($bookingDataArray['start_date']); $startDate = $date->format('F j, Y'); $date = new DateTime($bookingDataArray['end_date']); $endDate = $date->format('F j, Y'); dd($bookingDataArray); $conciergeCategoriesData = getConciergeCategoriesData(); $allCategoryItems = array(); $bookingData = array('BookingDate' => substr($bookingDataArray['created'], 0, strpos($bookingDataArray['created'], " ")), 'BookingNumber' => $bookingDataArray['booking_number'], 'ArrivalDate' => $startDate, 'DepartureDate' => $endDate, 'PropertyType' => $bookingDataArray['property_data']['type_name'], 'PropertyAddress' => $bookingDataArray['property_data']['area_name'] . " " . $bookingDataArray['property_data']['country_name'], 'GuestName' => $bookingDataArray['client_account_name'], 'GuestEmail' => $bookingDataArray['client_contact_data']['email_address'], 'GuestPhone' => $bookingDataArray['client_contact_data']['phone_home'] ? $bookingDataArray['client_contact_data']['phone_home'] : $bookingDataArray['client_contact_data']['phone_mobile']); $contactData = array('YourAgent' => "", 'LocalAgent' => "", 'Concierge' => "", 'EmergencyContact' => ""); $propertyTerms = array('CheckIn' => "", 'CheckOut' => "", 'Payment' => "", 'Cancellation' => "", 'StayExtensions' => "", 'PropertyRules' => "", 'Smoking' => "Absolutely NO smoking inside the property."); // get booking data $bookingInfo = array('bookingData' => $bookingData, 'contactData' => $contactData, 'propertyTerms' => $propertyTerms); // initialize templates $twig = (new TwigController())->getTwigEnvironment(); $actionPageURL = "bookNowConfirmation.php?booking_number=" . $bookingDataArray['booking_number']; // start page $pageTitle = $defaultCompanyName . " - Book Now Confirmation";
/** * get current bookings * @return number|string */ function churchresource_getCurrentBookings() { $txt = ""; if (user_access("view", "churchresource")) { include_once "churchresource_db.php"; // all bookings from now up tomorrow with status 2 $res = getBookings(0, 1, "2"); if ($res != null) { $arr = array(); $counter = 0; foreach ($res as $r) { $r->startdate = new DateTime($r->startdate); $r->enddate = new DateTime($r->enddate); $ds = getAllDatesWithRepeats($r, 0, 1); if ($ds) { foreach ($ds as $d) { $counter++; //TODO: not used $arr[] = array("realstart" => new DateTime($d->format('Y-m-d H:i:s')), "startdate" => $r->startdate, "enddate" => $r->enddate, "person_name" => $r->person_name, "resource_id" => $r->resource_id, "repeat_id" => $r->repeat_id, "text" => $r->text, "id" => $r->id); } } } if (count($arr)) { $resources = churchcore_getTableData("cr_resource"); // custom sort function: cause there can be repeats in sorted the events function cmp($a, $b) { if ($a["realstart"] == $b["realstart"]) { return 0; } else { if ($a["realstart"] > $b["realstart"]) { return 1; } else { -1; } } } usort($arr, "cmp"); foreach ($arr as $val) { $txt .= "<li><p><a href='?q=churchresource&id={$val['id']}'>{$val['text']}</a> "; if ($val["repeat_id"] > 0) { $txt .= '<img title="Serie startet vom ' . $val["startdate"]->format('d.m.Y H:i') . '" src="' . CHURCHRESOURCE . '/images/recurring.png" width="16px"/> '; } $txt .= "(" . $resources[$val["resource_id"]]->bezeichnung . ")<br/><small>" . $val["realstart"]->format('d.m.Y H:i') . " " . $val["person_name"] . "</small><br/>"; } if ($txt) { $txt = "<ul>{$txt}</ul>"; } } } } return $txt; }
public function getBookings($params) { return getBookings(); }