} $display_dates_and_time_ranges[] = $date . ' ' . $time_range; // Display $day++; } // CHECK AVAILABILITY OF DATE TIME DATA $scheduled_slots = count($scheduled_date_time_data); //echo "Scheduled Slots: ".$scheduled_slots."<br />"; $available_date_time_data = array(); $unavailable_date_time_data = array(); $availability_count = check_schedule_availability($scheduled_date_time_data, $location_db_name[stripslashes($_REQUEST['location'])]); //echo "Availability Count: ".$availability_count."<br />"; // All slots not available condition check. if ($scheduled_slots > $availability_count) { $page_error_message = 'Availability Problem: Not all of the selected date and time slots ' . 'are available for booking. Please check the conflicting date and time slots, ' . 'make the necessary changes to your booking form and try again.'; $unavailable_date_time_data = find_schedule_unavailability($scheduled_date_time_data, $location_db_name[stripslashes($_REQUEST['location'])]); if (count($unavailable_date_time_data) > 0) { $available_date_time_data = array_minus_array($scheduled_date_time_data, $unavailable_date_time_data); } } else { if (!ignoreRules && $availability_count > $remaining_booking_slots_allowed && ($user_info['max_bookings'] == '' || $user_info['max_bookings'] != 0)) { //user is attempting to book more slots than they are allowed to (and they are not allowed unlimited bookings). //report error to user and do not allow the booking without ammendments $page_error_message = 'You are attempting to book ' . $availability_count . ' slot'; if ($availability_count > 1) { $page_error_message .= 's'; } $page_error_message .= ', however you '; if ($total_bookings_already_made > 0) { $page_error_message .= 'already have ' . $total_bookings_already_made . ' slot'; if ($total_bookings_already_made > 1) {
} $display_dates_and_time_ranges[] = $date . ' ' . $time_range; // Display $day++; } // CHECK AVAILABILITY OF DATE TIME DATA $scheduled_slots = count($scheduled_date_time_data); //echo "Scheduled Slots: ".$scheduled_slots."<br />"; $available_date_time_data = array(); $unavailable_date_time_data = array(); $availability_count = check_schedule_availability($scheduled_date_time_data, $location_db_name[$_REQUEST['location']]); //echo "Availability Count: ".$availability_count."<br />"; // All slots not available condition check. if ($scheduled_slots > $availability_count) { $page_error_message = 'Availability Problem: Not all of the selected date and time slots ' . 'are available for booking. Please check the conflicting date and time slots, ' . 'make the necessary changes to your booking form and try again.'; $unavailable_date_time_data = find_schedule_unavailability($scheduled_date_time_data, $location_db_name[$_REQUEST['location']]); if (count($unavailable_date_time_data) > 0) { $available_date_time_data = array_minus_array($scheduled_date_time_data, $unavailable_date_time_data); } } else { $available_date_time_data = $scheduled_date_time_data; } } // IF ALL IS WELL WITH THE SCHEDULE DATA AVAILABILITY - ADD EVENT DATA echo "valid user: "******"<br />user_id: " . get_user_id($_SESSION['valid_user']) . "<br />"; if ($page_error_message == '' && !empty($_POST['add_event'])) { // Attempt to Add the Event to the Database $add_event_id = add_event($_SESSION['valid_user'], $scheduled_date_time_data, $_REQUEST['subject'], $_REQUEST['location'], $starting_date . ' ' . $_REQUEST['start_time'], $ending_date . ' ' . $_REQUEST['end_time'], $_REQUEST['recur_interval'], $_REQUEST['recur_freq'], $recur_date, $_REQUEST['desc']); echo "<pre>"; var_dump($_SESSION['valid_user'], $scheduled_date_time_data, $_REQUEST['subject'], $_REQUEST['location'], $starting_date . ' ' . $_REQUEST['start_time'], $ending_date . ' ' . $_REQUEST['end_time'], $_REQUEST['recur_interval'], $_REQUEST['recur_freq'], $recur_date, $_REQUEST['desc']); echo "</pre>";