Exemple #1
0
            echo " in the drop down list, then please select another time to try again.</p>";
        } else {
            echo "We are sorry.  There are no spaces available to rent for that time period.  Please select another time and try again.";
        }
    }
} else {
    if (isset($_POST['submitted2'])) {
        // note validation SHOULD occur here (user input should never be trusted), but this is outside the scope of this project
        $serviceId = trim($_POST['service']);
        $dayOffset = trim($_POST['day']);
        $startTime = trim($_POST['time']);
        $help = trim($_POST['helpRequired']);
        $roomRequest = trim($_POST['roomRequest']);
        echo "<h2>Create an appointment - Complete</h2>";
        $appointment = new Appointment();
        $appointment->setByOffset($user, $serviceId, $dayOffset, $startTime, $help);
        $appointment->reserveAppointment();
        $appointment->reserveResource($roomRequest);
        $workSpace = $appointment->getAttachedResources('S');
        echo "<p>Congratulations! Your appointment has been reserved!</p>";
        echo "<p><strong><u>Appointment Details:</u></strong></p><div class='indented'>";
        echo "<strong>Service name:</strong> " . $appointment->service->name . "<br /><strong>Service cost:</strong> \$" . $appointment->service->cost;
        echo "<br /><strong>Start time:</strong> " . $appointment->startDateDisplay . "<br /><strong>End time:</strong> " . $appointment->endDateDisplay . "<br /><strong>Workspace:</strong> " . $workSpace->name . "<br /><strong>Workspace cost:</strong> \$" . $workSpace->price;
        echo "<br /><strong>Help:</strong> ";
        if ($help == null) {
            echo "No help requested<br /><br /></div>";
        } else {
            echo "Help requested<br /><br /></div>";
        }
        $total = $appointment->service->cost + $workSpace->price;
        echo "<br /><strong><u>Total Amount Owed:</u></strong> \$" . $total . "<br /><br />";